Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0c5a6443 authored by ADILI Robin's avatar ADILI Robin
Browse files

do not pull requirements when building sdist

parent 67075c46
No related branches found
No related tags found
No related merge requests found
FROM quay.io/pypa/manylinux2014_x86_64
COPY . /fbxsdkpy
CMD ./buildall.sh
# FBXSDK Python Bindings
This repository contains scripts to create a Source Distribution (sdist) for the FBXSDK Python Bindings and build wheels (package with binaries) for various platforms and versions from it
**Packages for the Source Distribution and wheels can be installed with pip (see Install)**
This the Source Distribution (sdist) repository for the FBXSDK Python Bindings
**Packages for the Source Distribution and wheels (prebuilt binaries) can be installed with pip (see Install)**
## Install
1. Obtain a [Gitlab Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token) to authenticate to the project pypi repository
2. Run the following command, with `<Gitlab Token>` replaced with your personal token :
```
pip install --extra-index-url https://__token__:<Gitlab Token>@gitlab.inria.fr/api/v4/projects/18034/packages/pypi/simple fbxsdkpy
pip --verbose install --extra-index-url https://__token__:<Gitlab Token>@gitlab.inria.fr/api/v4/projects/18034/packages/pypi/simple fbxsdkpy
```
If there is no wheel available for your platform, pip will attempt to build from source using the Source Distribution
If there is no wheel available for your platform, pip will attempt to build from source
To force an install from source, pass the `--no-binary` option to pip
## Create a Source Distribution
## Manual Build
The Source distribution is obtained by downloading the FBXSDK libraries and Python Bindings for Linux and Windows from Autodesk, then patching them to work with sip5
Alternatively, the bindings can be built and installed by cloning this repository and running `pip --verbose install .`
## Build wheels for package distribution
### GNU/Linux
Wheels need to be built inside a manylinux2014 environment, a Docker image is used for that purpose
1. `docker run -t -v .:/fbxsdkpy`
### Windows
1. `build.bat`
### Remarks
Instead of the libraries and bindings from Autodesk being included in the repository, they are downloaded before building
`--verbose` is recommended to get the output of the compiler in case of an error. Also, as compilation can take several minutes, `pip` might otherwise seem unresponsive
pushd %~dp0
SET "CURRENTDIR=%cd%"
SET "BUILDDIR=%CURRENTDIR%\build"
SET "BUILDTOOLSDIR=%BUILDDIR%\buildtools"
SET "VCVARSBAT=%BUILDTOOLSDIR%\VC\Auxiliary\Build\vcvars64.bat"
SET "SIPDIR=%BUILDDIR%\sip-4.19.3"
SET "SIPINSTALLDIR=%BUILDDIR%\sipinstall"
SET "vs_buildtoolsexe=%BUILDDIR%\vs_buildtools.exe"
SET "FBXSDKDIR=%BUILDDIR%\fbxsdk"
SET "FBXSDKPYTHONDIR=%BUILDDIR%\fbxsdkpy"
SET "FBXDIR=%CURRENTDIR%\fbx"
mkdir "%BUILDDIR%"
mkdir "%BUILDTOOLSDIR%"
mkdir "%SIPINSTALLDIR%"
mkdir "%FBXSDKDIR%"
mkdir "%FBXSDKPYTHONDIR%"
mkdir "%FBXDIR%"
echo "Download and install Visual Studio Build Tools (nmake, MSVC, link, etc.)"
curl -L -o %vs_buildtoolsexe% https://aka.ms/vs/16/release/vs_buildtools.exe
%vs_buildtoolsexe% --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Mi
crosoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows
81SDK --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
echo "Load environment variables to use Build Tools from this script"
call %VCVARSBAT%
for /F "tokens=1,2 delims=;" %%i in (reqs_win.txt) do (
curl -L -o "%BUILDDIR%\%%i.exe" %%j
"%BUILDDIR%\%%i.exe" /S /D=%BUILDDIR%\%%i
)
::curl -L -O "https://gitlab.inria.fr/radili/fbxsdk_python/uploads/12002ae82d20e4d6b60107dacb5abe4b/sip-4.19.3.tar.gz"
tar xvf sip-4.19.3.tar.gz -C "%BUILDDIR%"
cd "%BUILDDIR%"\sip-*
python "configure.py" -b "%SIPINSTALLDIR%" -d "%SIPINSTALLDIR%" -e "%SIPINSTALLDIR%" --pyidir="%SIPINSTALLDIR%"
nmake
nmake install
cd %CURRENTDIR%
copy "PythonBindings.py" "%FBXSDKPYTHONDIR%/PythonBindings.py"
SET "FBXSDK_ROOT=%FBXSDKDIR%"
SET "SIP_ROOT=%SIPDIR%"
python "%FBXSDKPYTHONDIR%"/PythonBindings.py Python3_x64
copy "%FBXSDKPYTHONDIR%\build\Distrib\site-packages\fbx\*" "%FBXDIR%"
copy "%SIPINSTALLDIR%\sip.pyd" "%FBXDIR%"
%vs_buildtoolsexe% uninstall --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 -
-remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Compone
nt.Windows81SDK --remove Microsoft.VisualStudio.Workload.VCTools --remove Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --remove Microsoft.VisualStudio.Comp
onent.Windows10SDK || IF "%ERRORLEVEL%"=="3010" EXIT 0
popd
pause
\ No newline at end of file
pushd %~dp0
SET "CURRENTDIR=%cd%"
SET "BUILDDIR=%CURRENTDIR%\build"
SET "BUILDTOOLSDIR=%BUILDDIR%\buildtools"
SET "VCVARSBAT=%BUILDTOOLSDIR%\VC\Auxiliary\Build\vcvars64.bat"
SET "SIPDIR=%BUILDDIR%\sip-4.19.3"
SET "SIPINSTALLDIR=%BUILDDIR%\sipinstall"
SET "vs_buildtoolsexe=%BUILDDIR%\vs_buildtools.exe"
SET "FBXSDKDIR=%BUILDDIR%\fbxsdk"
SET "FBXSDKPYTHONDIR=%BUILDDIR%\fbxsdkpy"
:: PYTHONVERSION=$(python -c [...]) #lol
for /f %%i in ('python -c "import sys; print(''.join(sys.version.split(' ')[0].split('.')[:2]))"') do set PYTHONVERSION=%%i
SET "FBXDIR=%CURRENTDIR%\fbxsdkpy-cp%PYTHONVERSION%-win_x64"
mkdir "%BUILDDIR%"
mkdir "%BUILDTOOLSDIR%"
mkdir "%SIPINSTALLDIR%"
mkdir "%FBXSDKDIR%"
mkdir "%FBXSDKPYTHONDIR%"
mkdir "%FBXDIR%"
echo "Download and install Visual Studio Build Tools (nmake, MSVC, link, etc.)"
curl -L -o %vs_buildtoolsexe% https://aka.ms/vs/16/release/vs_buildtools.exe
%vs_buildtoolsexe% --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows81SDK --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK|| IF "%ERRORLEVEL%"=="3010" EXIT 0
echo "Load environment variables to use Build Tools from this script"
call %VCVARSBAT%
for /F "tokens=1,2 delims=;" %%i in (reqs_win.txt) do (
curl -L -o "%BUILDDIR%\%%i.exe" %%j
"%BUILDDIR%\%%i.exe" /S /D=%BUILDDIR%\%%i
)
::curl -L -O "https://gitlab.inria.fr/radili/fbxsdk_python/uploads/12002ae82d20e4d6b60107dacb5abe4b/sip-4.19.3.tar.gz"
tar xvf sip-4.19.3.tar.gz -C "%BUILDDIR%"
cd "%BUILDDIR%"\sip-*
python "configure.py" -b "%SIPINSTALLDIR%" -d "%SIPINSTALLDIR%" -e "%SIPINSTALLDIR%" --pyidir="%SIPINSTALLDIR%" --sip-module="fbxsip"
nmake
nmake install
cd %CURRENTDIR%
copy "PythonBindings.py" "%FBXSDKPYTHONDIR%\PythonBindings.py"
SET "FBXSDK_ROOT=%FBXSDKDIR%"
SET "SIP_ROOT=%SIPDIR%"
python "%FBXSDKPYTHONDIR%"\PythonBindings.py Python3_x64
copy "%FBXSDKPYTHONDIR%\build\Distrib\site-packages\fbx\*" "%FBXDIR%"
copy "%SIPINSTALLDIR%\fbxsip.pyd" "%FBXDIR%"
%vs_buildtoolsexe% uninstall --quiet --wait --norestart --nocache --installPath "%BUILDTOOLSDIR%" --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows81SDK --remove Microsoft.VisualStudio.Workload.VCTools --remove Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --remove Microsoft.VisualStudio.Component.Windows10SDK || IF "%ERRORLEVEL%"=="3010" EXIT 0
popd
pause
#!/bin/bash
set -x
which python
python --version
origdir=$(pwd)
scdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
builddir="$scdir"/build
fbxsdkdir="$builddir"/fbxsdk
fbxpydir="$builddir"/fbxpy
reqsfile="${scdir}"/reqs.txt
[ -d "$builddir" ] || mkdir "$builddir"
# download fbxsdk
if [ ! -d "$fbxsdkdir" ]
then
mkdir "$fbxsdkdir"
url=$(grep 'fbx.*fbxsdk' $reqsfile)
file=${url##*/}
tar="${fbxsdkdir}/${file}"
curl -L -o "$tar" $url
tar -xvzf "$tar" -C "$fbxsdkdir"
printf "yes\nn\n" |"$fbxsdkdir"/fbx*fbxsdk_linux "$fbxsdkdir"
# patch libfbxsdk.so because it is not linked against libxml2 and libz for some reason
patchelf --add-needed libz.so.1 ${fbxsdkdir}/lib/gcc/x64/release/libfbxsdk.so
patchelf --add-needed libxml2.so.2 ${fbxsdkdir}/lib/gcc/x64/release/libfbxsdk.so
else
echo "Skipping installation of fbxsdk because "$fbxsdkdir" exists"
fi
# download fbxsdk python bindings
if [ ! -d "$fbxpydir" ]
then
mkdir "$fbxpydir"
url=$(grep 'fbx.*fbxpythonbindings_linux' $reqsfile)
file=${url##*/}
tar="${fbxpydir}/${file}"
curl -L -o "$tar" $url
tar -xvzf "$tar" -C "$fbxpydir"
printf "yes\nn\n"|"$fbxpydir"/fbx*fbxpythonbindings_linux "$fbxpydir"
# patch sip files and library headers so that they compile with sip5
patch -N -p0 < patch
else
echo "Skipping installation of fbx python bindings because "$fbxpydir" exists"
fi
sip-wheel --verbose
LD_LIBRARY_PATH=${fbxsdkdir}/lib/gcc/x64/release/:$LD_LIBRARY_PATH auditwheel -v repair $(ls -1t fbx*.whl|head -1)
#!/bin/bash
ifss="$IFS"
IFS=$'\n'
for a in $(ls -d /opt/python/cp3*/);do
PATH=${a}bin/:$PATH python -m pip install sip
PATH=${a}bin/:$PATH ./build.sh
done
IFS="$ifss"
......@@ -77,7 +77,7 @@ class FBXSDKBuilder(Builder):
installable.install(target_dir, installed)
if project.distinfo:
from .distinfo import create_distinfo
from sipbuild.distinfo import create_distinfo
create_distinfo(project.get_distinfo_dir(target_dir), wheel_tag,
installed, project.metadata, project.get_requires_dists(),
......
......@@ -46,9 +46,9 @@ class FBXSDKPyProject(Project):
libraries = []
if sys.platform == "win32":
if sys.version_info.major == 3 and sys.version_info.minor < 7:
libraries = self.win_libraries
else:
libraries = self.win_py36_libraries
else:
libraries = self.win_libraries
elif sys.platform == "linux":
libraries = self.linux_libraries
else:
......@@ -58,11 +58,13 @@ class FBXSDKPyProject(Project):
def setup(self, pyproject, tool, tool_description):
self.verbose = True
if sys.platform == "win32":
super().run_command(["call create_sdist.bat"],fatal=True)
elif sys.platform == "linux":
super().run_command(["./create_sdist.sh"],fatal=True)
else:
raise Exception("Your platform "+sys.platform+" is not supported")
# don't download Autodesk's stuff when making sdist
if tool != "sdist":
if sys.platform == "win32":
super().run_command(["call pull_reqs.bat"],fatal=True)
elif sys.platform == "linux":
super().run_command(["./pull_reqs.sh"],fatal=True)
else:
raise Exception("Your platform "+sys.platform+" is not supported")
super().setup(pyproject, tool, tool_description)
......@@ -15,6 +15,5 @@ for /F "tokens=1,2 delims=;" %%i in (reqs_win.txt) do (
curl -L -o "%BUILDDIR%\patch.py" "https://raw.githubusercontent.com/techtonik/python-patch/master/patch.py"
python "%BUILDDIR%\patch.py" patch
move "%BUILDDIR%\fbxsdk\lib\vs2017" "%BUILDDIR%\fbxsdk\lib\all"
move "%BUILDDIR%\fbxsdk\lib\vs2017" "%BUILDDIR%\fbxsdk\lib\all" >nul
popd
pause
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment