Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve setup.py to use system vapoursynth.dll #320

Merged
merged 11 commits into from
Jul 7, 2017

Conversation

stuxcrystal
Copy link
Contributor

@stuxcrystal stuxcrystal commented Jul 6, 2017

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:

  1. vapoursynth.dll and vapoursynth.lib from Release or x64/Release
  2. vapoursynth.dll and vapoursynth.lib from PATH
  3. vapoursynth.dll and vapoursynth.lib located in the Registry

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 using pip

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

@myrsloik
Copy link
Member

myrsloik commented Jul 6, 2017

Interesting, especially since the python module rarely changes nowadays. I'll probably merge it in a day or two when I'm not too sleepy to review the code

@myrsloik myrsloik merged commit e3eace5 into vapoursynth:master Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants