FluidityProject / fluidity

Fluidity
http://fluidity-project.org
Other
362 stars 113 forks source link

Account for distutils being deprecated and python3.10 becoming default on Ubuntu 22.04 #348

Closed Patol75 closed 2 years ago

Patol75 commented 2 years ago

Closes #346

I am opening this PR as a draft; it will be needed in the future given changes in the Python distribution. Please feel free to contribute, as it is likely I will succeed in figuring everything out.

I have tried to identify instances where distutils is used and replace them with equivalent logic from either setuptools or sysconfig.

Something of potential interest is setuptools indicating that the setup.py approach is deprecated. Instead, pyproject.toml and setup.cfg files should be used, in combination with the build and pip packages. I have tried to build the fluidity package this way.


Judging from Actions, Focal is successful, but Bionic does not find a valid version of Python.

Patol75 commented 2 years ago

I think this is starting to head in the right direction. I am giving it a CI test to see if the new python_build behaves.

@stephankramer

gnikit commented 2 years ago

@Patol75 you might want to have a look at https://github.com/nektos/act . I use it for local Actions testing. Maybe you can use it with only a couple failing tests, on a single docker container and get some info on the errors.

Also, I am not sure if this is relevant but HAVE_NUMPY if true, is never actually #defined in confdefs.h like the rest of our preprocessor macros, so that might lead to some cryptic failures.

Patol75 commented 2 years ago

Thanks for the suggestion. I tried, but I did not manage to get a successful build, unfortunately. I thought that fluidity being in the sudo group was the reason that Python could not find installed libraries, but apparently not.

Locally, if I run ./configure --enable-2d-adaptivity CPPFLAGS=-I/usr/local/include && make makefiles && sudo make clean && make -j && make -j fltools, followed by tools/testharness.py -f top_hat_cv.xml, I get Passes. Python libraries are properly installed at /home/thomas/.local/lib/python3.8/site-packages, and that is where they are imported from.

Patol75 commented 2 years ago

I am closing this PR as I will likely open a new one based on the deprecate_distutils_2 branch.