Skip to content

Commit 97b7b35

Browse files
MaxRayskiyFedr
andauthored
Fix pip distribution (#812)
* Update pip-build.yml * fic * fic * direct call * skip unit tests * another attempt * win python fix * test * test * add python libs * reinstall python * debug * py libs * build latest * return win unit test * update tests * undo debug Co-authored-by: Fedr <fchelnokov@adalisk.com>
1 parent 4e87189 commit 97b7b35

File tree

5 files changed

+59
-105
lines changed

5 files changed

+59
-105
lines changed

.github/workflows/pip-build.yml

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ jobs:
6161
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
6262
6363
- name: Install thirdparty libs
64-
run: ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
64+
run: |
65+
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
66+
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
6567
6668
- name: Build
6769
run: ./scripts/build_source.sh
@@ -129,6 +131,9 @@ jobs:
129131
- py-version: "3.10"
130132
py-tag: "cp310"
131133
py-short-version: "310"
134+
py-dir: "Python310"
135+
py-file: "python310"
136+
embed-version: "3.10.0"
132137
- py-version: "3.11"
133138
py-tag: "cp311"
134139
py-short-version: "311"
@@ -149,17 +154,10 @@ jobs:
149154
run: docker run -d --name meshlib-win --workdir C:\workspace\MeshLib\MeshLib -v ${{ github.workspace }}\..\..:C:\workspace meshrus/meshlib-windows:latest ping -t localhost
150155

151156
- name: Setup python
152-
if: ${{ matrix.py-version != '3.10' }}
153157
run: |
154158
docker exec meshlib-win choco uninstall python python3 -y
155159
docker exec meshlib-win choco install python3 --version=${{matrix.py-version}} -y
156-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus\lib meshlib-win powershell.exe -c "Remove-Item python310.*"
157-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus\bin meshlib-win powershell.exe -c "Remove-Item python310.*"
158-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus meshlib-win powershell.exe -c "Copy-Item -Path C:\${{matrix.py-dir}}\${{matrix.py-file}}.dll -Destination bin"
159160
docker exec -w C:\vcpkg\installed\x64-windows-meshrus meshlib-win powershell.exe -c "Copy-Item -Path C:\${{matrix.py-dir}}\libs\${{matrix.py-file}}.lib -Destination lib"
160-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus\include meshlib-win powershell.exe -c "Remove-Item python3.10 -Recurse"
161-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus\include meshlib-win powershell.exe -c "mkdir python3.10"
162-
docker exec -w C:\vcpkg\installed\x64-windows-meshrus\include meshlib-win powershell.exe -c "Copy-Item -Path C:\${{matrix.py-dir}}\include\* -Destination python3.10 -Recurse"
163161
docker exec meshlib-win py -${{matrix.py-version}} -m pip install --upgrade pip
164162
docker exec meshlib-win py -${{matrix.py-version}} -m pip install --upgrade -r ./requirements/python.txt
165163
docker exec -w C:\workspace\MeshLib\MeshLib\thirdparty\python meshlib-win curl https://www.python.org/ftp/python/${{matrix.embed-version}}/python-${{matrix.embed-version}}-embed-amd64.zip --output python-embed.zip
@@ -168,20 +166,13 @@ jobs:
168166
- name: Build
169167
run: |
170168
docker exec meshlib-win C:\vcpkg\vcpkg.exe integrate install
171-
docker exec meshlib-win C:\Temp\vcbuildtools\\MSBuild\Current\Bin\MSBuild.exe source\MeshLib.sln -p:Configuration=Release -p:PythonVersion=${{matrix.py-short-version}} -p:PythonLibPath=C:\${{matrix.py-dir}}\libs\${{matrix.py-file}}.lib -p:PythonDllPath=C:\${{matrix.py-dir}}\${{matrix.py-file}}.dll
172-
173-
# cant fix embedded python 3.9 for windows yet, but this embedded python is not used in wheel, so we can just disable it this way
174-
- name: Embedded Python3.9 fix
175-
if: ${{ matrix.py-version == '3.9' }}
176-
working-directory: source\x64\Release
177-
run: del python39.zip
178-
shell: cmd
169+
docker exec meshlib-win C:\Temp\vcbuildtools\\MSBuild\Current\Bin\MSBuild.exe source\MeshLib.sln -p:Configuration=Release -p:PythonVersion=${{matrix.py-short-version}} -p:PythonLibPath=C:\${{matrix.py-dir}}\libs\${{matrix.py-file}}.lib -p:PythonDllPath=C:\${{matrix.py-dir}}\${{matrix.py-file}}.dll -p:PythonIncludePath=C:\${{matrix.py-dir}}\include\
179170
180171
- name: Run Test
181172
working-directory: source\x64\Release
182173
run: .\MeshViewer.exe -tryHidden -noEventLoop
183174

184-
- name: Unit Tests Default
175+
- name: Unit Tests
185176
run: docker exec meshlib-win py -3 scripts\run_unit_test_script.py Release
186177

187178
- name: Python Tests
@@ -322,12 +313,12 @@ jobs:
322313
strategy:
323314
fail-fast: false
324315
matrix:
325-
os: ["ubuntu:20.04", "ubuntu:22.04", "fedora:35", "fedora:37"]
316+
os: ["ubuntu:20.04", "ubuntu:22.04", "debian:11-slim", "fedora:37"]
326317
include:
327318
- os: "ubuntu:20.04"
328319
py-version: "3.8"
329320
py-cmd: "python3.8"
330-
- os: "fedora:35"
321+
- os: "debian:11-slim"
331322
py-version: "3.9"
332323
py-cmd: "python3.9"
333324
- os: "ubuntu:22.04"
@@ -343,15 +334,9 @@ jobs:
343334
ref: ${{needs.setup.outputs.version_tag}}
344335

345336
- name: Ubuntu system setup
346-
if: ${{ matrix.os == 'ubuntu:20.04' || matrix.os == 'ubuntu:22.04'}}
337+
if: ${{ matrix.os == 'ubuntu:20.04' || matrix.os == 'ubuntu:22.04' || matrix.os == 'debian:11-slim' }}
347338
run: apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-distutils python3-pip
348339

349-
- name: Fedora 35 system setup
350-
if: ${{ matrix.os == 'fedora:35'}}
351-
uses: actions/setup-python@v4
352-
with:
353-
python-version: ${{ matrix.py-version }}
354-
355340
- name: Fedora 37 system setup
356341
if: ${{matrix.os == 'fedora:37'}}
357342
run: dnf -y install python3 pip

.github/workflows/release-tests.yml

Lines changed: 27 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,40 @@ jobs:
2323
runs-on: ubuntu-latest
2424
container:
2525
image: ${{ matrix.os }}
26-
options: --user root
2726
strategy:
2827
fail-fast: false
2928
matrix:
30-
os: ["ubuntu:20.04", "ubuntu:22.04", "fedora:35"]
29+
os: ["ubuntu:20.04", "ubuntu:22.04", "debian:11-slim", "fedora:37"]
3130
include:
3231
- os: "ubuntu:20.04"
3332
py-version: "3.8"
3433
py-cmd: "python3.8"
3534
- os: "ubuntu:22.04"
3635
py-version: "3.10"
3736
py-cmd: "python3.10"
38-
- os: "fedora:35"
37+
- os: "debian:11-slim"
3938
py-version: "3.9"
4039
py-cmd: "python3.9"
40+
- os: "fedora:37"
41+
py-version: "3.11"
42+
py-cmd: "python3.11"
4143
steps:
4244
- name: Checkout
4345
uses: actions/checkout@v3
4446
with:
4547
ref: ${{needs.setup.outputs.version_tag}}
4648

47-
- name: Python setup
48-
if: ${{ matrix.os == 'fedora:35'}}
49-
uses: actions/setup-python@v4
50-
with:
51-
python-version: ${{ matrix.py-version }}
49+
- name: Ubuntu system setup
50+
if: ${{ matrix.os == 'ubuntu:20.04' || matrix.os == 'ubuntu:22.04' || matrix.os == 'debian:11-slim' }}
51+
run: apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-distutils python3-pip
5252

53-
- name: System setup
54-
if: ${{ matrix.os != 'fedora:35'}}
55-
run: |
56-
apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-distutils python3-pip
53+
- name: Fedora 37 system setup
54+
if: ${{matrix.os == 'fedora:37'}}
55+
run: dnf -y install python3 pip
5756

5857
- name: Pip setup
5958
run: |
6059
${{ matrix.py-cmd }} -m pip install --upgrade pip
61-
${{ matrix.py-cmd }} -m pip uninstall -y meshlib
62-
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
6360
6461
- name: Meshlib wheel install
6562
run: ${{ matrix.py-cmd }} -m pip install meshlib
@@ -75,7 +72,7 @@ jobs:
7572
strategy:
7673
fail-fast: false
7774
matrix:
78-
py-version: ["3.8", "3.9", "3.10" ]
75+
py-version: ["3.8", "3.9", "3.10", "3.11"]
7976
steps:
8077
- name: Checkout
8178
uses: actions/checkout@v3
@@ -89,78 +86,38 @@ jobs:
8986

9087
- name: Pip setup
9188
run: |
92-
py -${{matrix.py-version}} -m pip install --upgrade pip
93-
py -${{matrix.py-version}} -m pip uninstall -y meshlib
94-
py -${{matrix.py-version}} -m pip install --upgrade -r ./requirements/python.txt
89+
py -${{matrix.py-version}} -m pip install --upgrade pip
9590
py -${{matrix.py-version}} -m pip install meshlib
9691
9792
- name: Run Python tests
9893
working-directory: test_python
9994
run: py -${{matrix.py-version}} -m pytest -s -v
10095

101-
install-test:
96+
pip-test-macos:
97+
needs: setup
10298
timeout-minutes: 20
103-
runs-on: ubuntu-latest
104-
container:
105-
image: ${{matrix.container}}
106-
options: --user root
99+
runs-on: macos-12
107100
strategy:
108101
fail-fast: false
109102
matrix:
110-
os: [Ubuntu20, Ubuntu22, Fedroa35]
111-
include:
112-
- os: Ubuntu20
113-
container: ubuntu:20.04
114-
fileName: "*ubuntu20*"
115-
updateCmd: export DEBIAN_FRONTEND=noninteractive && apt-get -y update && apt-get -y upgrade && apt-get -y install sudo
116-
installCmd: apt-get -y install ./*.deb
117-
- os: Ubuntu22
118-
container: ubuntu:22.04
119-
fileName: "*ubuntu22*"
120-
updateCmd: export DEBIAN_FRONTEND=noninteractive && apt-get -y update && apt-get -y upgrade && apt-get -y install sudo
121-
installCmd: apt-get -y install ./*.deb
122-
- os: Fedroa35
123-
container: fedora:35
124-
fileName: "*-dev.rpm"
125-
updateCmd: dnf --refresh -y upgrade
126-
installCmd: dnf -y install ./*.rpm
103+
py-version: ["3.8", "3.9", "3.10", "3.11"]
127104
steps:
128105
- name: Checkout
129106
uses: actions/checkout@v3
107+
with:
108+
ref: ${{needs.setup.outputs.version_tag}}
130109

131-
- name: Python setup on Fedora
132-
if: ${{ matrix.os == 'Fedroa35'}}
133-
run: |
134-
dnf -y install python3.9 curl
135-
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9
136-
python3.9 -m pip install --upgrade -r ./requirements/python.txt
110+
- name: Python setup
111+
if: ${{ matrix.py-version != '3.11' }}
112+
run: brew install python@${{matrix.py-version}}
137113

138-
- name: System setup
139-
if: ${{ matrix.os != 'Fedroa35'}}
114+
- name: Pip setup
140115
run: |
141-
apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-distutils python3-pip
142-
python3 -m pip install --upgrade pip
143-
python3 -m pip install --upgrade -r ./requirements/python.txt
144-
145-
- name: Download Release
146-
uses: robinraju/release-downloader@v1.6
147-
with:
148-
repository: MeshInspector/MeshLib
149-
latest: true
150-
fileName: ${{matrix.fileName}}
151-
out-file-path: ""
116+
${{ matrix.py-cmd }} -m pip install --upgrade pip
152117
153-
- name: Install Release
154-
run: |
155-
${{matrix.updateCmd}}
156-
${{matrix.installCmd}}
118+
- name: Meshlib wheel install
119+
run: ${{ matrix.py-cmd }} -m pip install meshlib
157120

158121
- name: Run Python tests
159-
if: ${{ matrix.os != 'Fedroa35'}}
160122
working-directory: test_python
161-
run: python3 -m pytest -s -v
162-
163-
- name: Run Python tests on Fedora
164-
if: ${{ matrix.os == 'Fedroa35'}}
165-
working-directory: test_python
166-
run: python3.9 -m pytest -s -v
123+
run: ${{ matrix.py-cmd }} -m pytest -s -v

.github/workflows/test-distribution.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ jobs:
3939
if: ${{ matrix.os != 'fedora:35' }}
4040
run: |
4141
export DEBIAN_FRONTEND=noninteractive && apt-get -y update && apt-get -y upgrade && \
42-
apt-get -y install sudo xvfb && \
42+
apt-get -y install sudo xvfb curl libssl-dev python3-distutils python3-pip && \
4343
apt-get -y install ./*${{matrix.name}}*.deb
44+
python3 -m pip install --upgrade pip
45+
python3 -m pip install --upgrade -r ./requirements/python.txt
4446
4547
- name: Install Fedora Release
4648
if: ${{ matrix.os == 'fedora:35' }}
4749
run: |
4850
dnf --refresh -y upgrade
49-
dnf -y install xorg-x11-server-Xvfb mesa-dri-drivers mesa-libGL-devel libXi-devel
51+
dnf -y install xorg-x11-server-Xvfb mesa-dri-drivers mesa-libGL-devel libXi-devel python3.9 curl
5052
dnf -y install ./*.rpm
53+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.9
54+
python3.9 -m pip install --upgrade -r ./requirements/python.txt
5155
5256
- name: Debug output
5357
if: always()
@@ -70,4 +74,13 @@ jobs:
7074
cmake .. -DCMAKE_CXX_COMPILER=${{matrix.cxx-compiler}} && \
7175
cmake --build . && \
7276
./cmake-example
73-
77+
78+
- name: Ubuntu python test
79+
if: ${{ always() && matrix.os != 'fedora:35' }}
80+
working-directory: test_python
81+
run: python3 -m pytest -s -v
82+
83+
- name: Fedora python test
84+
if: ${{ always() && matrix.os == 'fedora:35' }}
85+
working-directory: test_python
86+
run: python3.9 -m pytest -s -v

source/MRMesh/MRMesh.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@
536536
</ClCompile>
537537
<Link>
538538
<SubSystem>Console</SubSystem>
539-
<GenerateDebugInformation>true</GenerateDebugInformation>
540-
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
539+
<GenerateDebugInformation>true</GenerateDebugInformation>
540+
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
541541
<DelayLoadDLLs>
542542
</DelayLoadDLLs>
543543
</Link>
@@ -573,7 +573,7 @@ copy $(ProjectDir)..\..\thirdparty\python\python310.zip $(TargetDir)python310.zi
573573
<EnableCOMDATFolding>true</EnableCOMDATFolding>
574574
<OptimizeReferences>true</OptimizeReferences>
575575
<GenerateDebugInformation>true</GenerateDebugInformation>
576-
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
576+
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies);$(PythonLibPath)</AdditionalDependencies>
577577
<DelayLoadDLLs>
578578
</DelayLoadDLLs>
579579
</Link>

source/common.props

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<PropertyGroup Label="Globals">
2626
<VcpkgCurrentInstalledDir>$(VcpkgRoot)\installed\$(VcpkgTriplet)</VcpkgCurrentInstalledDir>
2727
<PythonVersion>310</PythonVersion>
28+
<PythonIncludePath>$(VcpkgCurrentInstalledDir)\include\python3.10\</PythonIncludePath>
2829
<PythonLibPath>$(VcpkgCurrentInstalledDir)\lib\python$(PythonVersion).lib</PythonLibPath>
2930
<PythonDllPath>$(VcpkgCurrentInstalledDir)\bin\python$(PythonVersion).dll</PythonDllPath>
3031
</PropertyGroup>
@@ -34,7 +35,7 @@
3435
<LanguageStandard>stdcpplatest</LanguageStandard>
3536
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
3637
<PreprocessorDefinitions>MR_PROJECT_NAME="$(MeshLibProjectName)";NOMINMAX;_CRT_SECURE_NO_DEPRECATE;ImDrawIdx=unsigned;SPDLOG_COMPILED_LIB;SPDLOG_SHARED_LIB;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING;IMGUI_ENABLE_FREETYPE;IMGUI_DISABLE_OBSOLETE_FUNCTIONS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
37-
<AdditionalIncludeDirectories>$(MeshLibSourceDir);$(VcpkgCurrentInstalledDir)\include\python3.10\;$(MeshLibDir)thirdparty\parallel-hashmap\;$(MeshLibDir)thirdparty\pybind11\include\;$(VcpkgCurrentInstalledDir)\include\suitesparse\;$(MeshLibDir)thirdparty\imgui\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
38+
<AdditionalIncludeDirectories>$(MeshLibSourceDir);$(PythonIncludePath);$(MeshLibDir)thirdparty\parallel-hashmap\;$(MeshLibDir)thirdparty\pybind11\include\;$(VcpkgCurrentInstalledDir)\include\suitesparse\;$(MeshLibDir)thirdparty\imgui\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
3839
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
3940
<MultiProcessorCompilation>true</MultiProcessorCompilation>
4041
<UseStandardPreprocessor>true</UseStandardPreprocessor>
@@ -75,8 +76,6 @@
7576
-->
7677
<DisableSpecificWarnings>4061;4250;4324;4365;4371;4388;4435;4514;4582;4583;4599;4605;4623;4625;4626;4668;4710;4711;4820;4868;5026;5027;5031;5039;5045;5104;5105;5219;5243;5246;5262;5264;26451;%(DisableSpecificWarnings)</DisableSpecificWarnings>
7778
</ClCompile>
78-
</ItemDefinitionGroup>
79-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8079
<Link>
8180
<AdditionalDependencies>$(PythonLibPath);%(AdditionalDependencies)</AdditionalDependencies>
8281
</Link>

0 commit comments

Comments
 (0)