-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from PaulSt/pip
work on new pip install
- Loading branch information
Showing
9 changed files
with
174 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/bash | ||
set -e | ||
yum -y update | ||
yum -y install ninja-build fontconfig-devel tk-devel tcl-devel libXmu-devel mesa-libGLU-devel ccache | ||
|
||
py=/opt/python/cp39-cp39/bin/python | ||
$py fix_auditwheel_policy.py | ||
cd ../.. | ||
|
||
git config --global --add safe.directory '*' | ||
|
||
export ORIGINAL_PATH="$PATH" | ||
|
||
for pyversion in 38 39 310 | ||
do | ||
export PYDIR="/opt/python/cp${pyversion}-cp${pyversion}/bin" | ||
export PATH="$ORIGINAL_PATH:$PYDIR" | ||
#echo $PYDIR | ||
#$PYDIR/pip install -U pytest-check numpy wheel scikit-build mkl==2021.* mkl-devel==2021.* | ||
#$PYDIR/pip install netgen-mesher | ||
#NETGENDIR=/opt/_internal/cpython-3.9.13/bin | ||
|
||
#rm -rf /home/app/ngstrefftz/make | ||
rm -rf _skbuild | ||
$PYDIR/pip install ngsolve | ||
|
||
$PYDIR/pip wheel -vvv . | ||
auditwheel repair ngstrefftz*.whl | ||
rm -rf *.whl | ||
$PYDIR/pip uninstall -y ngsolve | ||
$PYDIR/pip uninstall -y netgen-mesher | ||
|
||
# avx2 build: | ||
rm -rf _skbuild | ||
$PYDIR/pip install ngsolve-avx2 | ||
NETGEN_ARCH=avx2 $PYDIR/pip wheel -vvv . | ||
auditwheel repair ngstrefftz*.whl | ||
rm -rf *.whl | ||
$PYDIR/pip uninstall -y ngsolve-avx2 | ||
$PYDIR/pip uninstall -y netgen-mesher-avx2 | ||
done | ||
|
||
$PYDIR/pip install -U twine | ||
#$PYDIR/twine upload wheelhouse/*manylinux*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
|
||
policy_file = "/opt/_internal/pipx/venvs/auditwheel/lib/python3.9/site-packages/auditwheel/policy/manylinux-policy.json" | ||
data = json.load(open(policy_file)) | ||
# todo: read libs from netgen.libs directory and remove hashes from names, then add just libmkl_rt.so.1 | ||
additional_libs = [ | ||
"libGLU.so.1", | ||
"libGLX.so.0", | ||
"libGLdispatch.so.0", | ||
"libOpenGL.so.0", | ||
"libXmu.so.6", | ||
"libbz2.so.1.0.6", | ||
"libcsg.so", | ||
"libcsgvis.so", | ||
"libfontconfig.so.1.11.1", | ||
"libfreetype.so.6.14.0", | ||
"libgeom2d.so", | ||
"libgeom2dvis.so", | ||
"libgui.so", | ||
"libinterface.so", | ||
"libmesh.so", | ||
"libmkl_rt.so.1", | ||
"libngcore.so", | ||
"libnggui.so", | ||
"libnglib.so", | ||
"libocc.so", | ||
"libpng15.so.15.13.0", | ||
"libstl.so", | ||
"libstlvis.so", | ||
"libtcl8.so", | ||
"libtk8.so", | ||
"libuuid.so.1.3.0", | ||
"libvisual.so", | ||
"libz.so.1.2.7", | ||
] | ||
|
||
for entry in data: | ||
if 'manylinux' in entry['name']: | ||
entry['lib_whitelist'] += additional_libs | ||
|
||
json.dump(data, open(policy_file, 'w')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM quay.io/pypa/manylinux2014_x86_64 | ||
USER root | ||
COPY . /home/app/ngstrefftz | ||
WORKDIR /home/app/ngstrefftz | ||
#RUN chmod +x build_pip.sh && ./build_pip.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
import os | ||
import re | ||
import subprocess | ||
|
||
def get_version(): | ||
""" | ||
Gets the current version number. | ||
|
@@ -93,6 +94,11 @@ def build_extension(self, ext): | |
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, | ||
'-DPYTHON_EXECUTABLE=' + sys.executable, | ||
'-DCMAKE_CXX_COMPILER=ngscxx'] | ||
if 'PYDIR' in os.environ: | ||
cmake_args += [f'-DCMAKE_PREFIX_PATH={os.environ["PYDIR"]}/..'] | ||
cmake_args += [f'-DPYTHON_EXECUTABLE={os.environ["PYDIR"]}/python3'] | ||
cmake_args += [f'-DPYTHON_LIBRARY={os.environ["PYDIR"]}/../lib'] | ||
cmake_args += [f'-DPYTHON_INCLUDE_DIR={os.environ["PYDIR"]}/../include'] | ||
cfg = 'Debug' if self.debug else 'Release' | ||
build_args = ['--config', cfg] | ||
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] | ||
|
@@ -110,26 +116,37 @@ def build_extension(self, ext): | |
# subprocess.check_call(['mkdir', 'ngstents'], cwd=self.build_lib) | ||
# subprocess.check_call(['mv', '_pytents.so', 'ngstents'], cwd=self.build_lib) | ||
|
||
import netgen.version | ||
import ngsolve | ||
netgen_name = netgen.config.NETGEN_PYTHON_PACKAGE_NAME | ||
avx2 = netgen_name.replace('netgen-mesher', '') # keep -avx2 suffix | ||
name = 'ngstrefftz' + avx2 | ||
install_requires = [ 'ngsolve'+avx2+'>='+ngsolve.__version__ ] | ||
|
||
if sys.argv[1] == "sdist": | ||
package_data = {"ngstrefftz": ["*" | ||
,"../test/*" | ||
,"../external_dependencies/ngstents/*"\ | ||
,"../external_dependencies/ngstents/src/*"\ | ||
,"../external_dependencies/ngstents/py/*"\ | ||
]} | ||
name += "-src" | ||
else: | ||
package_data = {} | ||
|
||
setup( | ||
name='ngstrefftz', | ||
name=name, | ||
version=str(get_version()), | ||
author='Paul Stocker', | ||
author_email='[email protected]', | ||
description='NGSTrefftz is an add-on to NGSolve for Trefftz methods.', | ||
long_description='NGSTrefftz provides a framework to implement Trefftz finite element spaces for NGSolve, with several Trefftz spaces already implemented. Additionally, Trefftz-DG on tent-pitched meshes for the acoustic wave equation is implemented using meshes provided by ngstents. Furthermore, the package includes an implementation of the embedded Trefftz method.', | ||
url="https://github.com/PaulSt/ngstrefftz", | ||
install_requires=install_requires, | ||
ext_modules=[CMakeExtension('ngstrefftz_py','src')], | ||
cmdclass=dict(build_ext=CMakeBuild), | ||
packages=["ngstrefftz"], | ||
package_dir={"ngstrefftz": "src"}, | ||
package_data={"ngstrefftz": ["*" | ||
,"../test/*" | ||
,"../external_dependencies/ngstents/*"\ | ||
,"../external_dependencies/ngstents/src/*"\ | ||
,"../external_dependencies/ngstents/py/*"\ | ||
]}, | ||
python_requires='>=3.5', | ||
# install_requires=[ | ||
# 'NGSolve>=6.2', | ||
# ] | ||
package_data=package_data, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters