Improve setup.py to use system vapoursynth.dll #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull-Request improves the setup.py file to allow it to install via pip.
How does it accomplish this?
This pull-request actually solves a related problem: Allowing the setup.py to detect the vapoursynth.dll installed by the installer.
The setup.py routine now try to locate the vapoursynth.dll using three ways:
Release
orx64/Release
The located vapoursynth.dll-file will be copied to Lib\site-packages during the installation and shipped in binary distributions of this package.
On linux there are no changes and no additional files except the module (and meta-data about the package) itself will be copied into site-packages. Linux based binary-distributions will not contain a vapoursynth.so file.
Dependencies
This PR introduces a dependency to setuptools. Since setuptools is packaged with current python versions, this will likely not prove to be a problem.
Installing from source needs Visual Studio 2015. Alternatively you can install vapoursynth inside the Native VS2017 build shell of the desired architecture.
Python distributions
The setup.py allows binary and source distributions to be compiled and uploaded to pypi. This section will address the state of both commands.
Source distributions
sdist
Using
python setup.py sdist
, a source distribution will be created that will create a.tar.gz
(or using--format=zip
a zip-file) containing the neccessary files to install the vapoursynth package by compiling.This package will neither ship with a vapoursynth.lib nor with a vapoursynth.dll or any other compiled file.
Wheels
bdist_wheel
Using
python setup.py bdist_wheel
, you can create a binary distribution that can be installed without the compiling anything.The wheel will ship with their own compiled version of
vapoursynth.dll
Since no compilation is being done here, the pip-bug below does not apply when installing vapoursynth using a wheel.
Instalation path
The setup will install both the vapoursynth.dll as well as the compiled cython module directly into site-packages.
pip
will remove both files when updating or removing the package.Release considerations
The
setup.py
file now contains the current release-number as its major version. This allows packages dependent on VapourSynth to specify the minimum required version of vapoursynth inside their setup.py file. Make sure the version remains up-to-date to allow users to update and specify their vapoursynth installation usingpip
Additionaly, the source distribution for vapoursynth as well as binary distributions for Windows x64, Windows x32, Linux x64 and Linux x32 should be uploaded to pypi.
Where to go from here.
Since we can expect pip to be installed on all Windows systems, we can change the module-installation routine in the Windows installer to instead install a binary-wheel created by setup.py using the pip installation of the package. The binary-wheel can be included by the installer.
Known Problems
Python 3.6 changed the way I/O is handled on Windows causing a bug on non-english Windows installations which is fixed here pypa/pip#4486
Until this fix is shipped with a new release of pip, change the code-page for the current command shell to UTF-8 by executing
chcp 65001
. This is not neccessary when installing using a binary distribution.Afterword
Since I cannot foresee all build-environments this thing is possibly gonna run on, additional testing may be helpful.
Additional things added in this PR
Added zimg and AviSynth+ to the .gitignore-file
References to other issues
Implements #283