mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
support pip installation #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @anthrotype on GitHub (Mar 30, 2015).
there is a problem if one tries to build the Python extension using the
pipinstaller. The problem is that the setup.py is not located in the root of the repository, but in thepythonbinding subfolder. The way pip works is to copy the source files to a temporary folder and try to build from there. But since the C/C++ source files are located higher in the repository tree (../enc,../dec) relative to setup.py, then pip does not (cannot?) copy these over to its temporary build folder, and therefore it fails to build the extension.A solution would be to make a hard copy (instead of a symlink) of the
encanddecfolders inside thepythonsubfolder. I believe git can efficiently handle such duplicate files and store them under the same object, as long as they have the same content.That means one would have to synchronise it every time there is a change. I don't know if anyone has a better solution...
The reason I want to use pip is to allow publishing the Brotli extension to the official Python Package Index (PyPI) repository. Once that is done, one could simply do
pip install brotlito download, build and install the extension. Besides, one could add brotli to the list of dependencies for other packages (e.g. fontTools, etc.).I wonder whether @khaledhosny has already thought about publishing the Brotli extension to PyPI?
I'm already experimenting in this direction in https://github.com/anthrotype/brotli-wheels
I'm trying to use Travis and Appveyor to automatically build pre-compiled Python wheel packages for Windows and OS X.
Please let me know what you think.
Thank you,
Cosimo
@khaledhosny commented on GitHub (Mar 30, 2015):
How are you building with pip? I do
pip install -e .routinely and had no issue with it.@anthrotype commented on GitHub (Mar 30, 2015):
I know, but that only runs
python setup developfor testing a package while developing it.The problem arises when doing
pip install ., without the-eoption.If you look at the traceback, the reason why pip fails is because it cannot find the C/C++ sources, since they are referenced using a relative path which is "above" the setup.py working directory:
@khaledhosny commented on GitHub (Mar 30, 2015):
I think we need to fix
sdistcommand, since it seems not to copy any of the Brotli source files. If this does not fixpip, it will at least allow uploading to PyPI.@anthrotype commented on GitHub (Mar 30, 2015):
I'll have look at sdist.
The thing is, the way pip (but also distutils, setuptools, etc.) expects python packages to be organised is with a setup.py at the root of the package, and then everything else positioned either on the same level or inside sub-folders reachable from the root. Whereas here we want to keep the python folder isolated from the C/C++ source files, which is understandable, but this seems to conflict with the way Python packaging works. Maybe the solution could simply be to clone brotli as a submodule in another repository with a copy of setup.py positioned higher in the directory tree.
@khaledhosny commented on GitHub (Mar 30, 2015):
That is how it was done originally :)
@anthrotype commented on GitHub (Mar 30, 2015):
yes, I do remember.
@khaledhosny commented on GitHub (Mar 31, 2015):
Thinking about it more, I think it shouldn’t harm to move the setup.py file to the top level directory, and leave the C file where it is, if it will simplify things.
@anthrotype commented on GitHub (Mar 31, 2015):
It would definitely make the Python extension's setup much easier.
On Tue, Mar 31, 2015 at 8:42 AM, Khaled Hosny notifications@github.com
wrote:
@szabadka commented on GitHub (Mar 31, 2015):
If it involves just the setup.py file, it should be ok to have it in the top-level directory.
@anthrotype commented on GitHub (Mar 31, 2015):
I can confirm pip is happy after
5e3e97e294