Skip to content

Commit

Permalink
Move zlib.h and friends into a subdirectory "extlibs" in lxml/include…
Browse files Browse the repository at this point in the history
…s/ to separate them from lxml-version.h etc.

These files are copied by setuptools as package data from an external install directory and thus need to be in a separate package to prevent conflicting with the content of the normal lxml.includes package.
  • Loading branch information
scoder committed Dec 13, 2021
1 parent f0a575a commit 745ac26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,6 +20,7 @@ MANIFEST
doc/api/lxml*.rst
doc/api/_build/
doc/s5/lxml-ep2008.html
src/lxml/includes/*/
src/lxml/includes/lxml-version.h
src/lxml/*.html
src/lxml/html/*.c
Expand Down
12 changes: 10 additions & 2 deletions setup.py
Expand Up @@ -180,12 +180,20 @@ def build_packages(files):

header_packages = build_packages(extract_files(include_dirs))

package_filename = "__init__.py"
for package_path, (root_path, filenames) in header_packages.items():
if not package_path:
# No need to add anything to 'lxml.includes' since it has a wildcard include.
continue
# lxml.includes -> lxml.includes.extlibs
package_path = "extlibs"
package = 'lxml.includes.' + package_path
packages.append(package)

# create '__init__.py' to make sure it's considered a package
if package_filename not in filenames:
with open(os.path.join(root_path, package_filename), 'wb') as f:
pass
filenames.append(package_filename)

assert package not in package_data
package_data[package] = filenames
assert package not in package_dir
Expand Down

6 comments on commit 745ac26

@graingert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scoder thanks for the quick fix here!

I see the release here https://github.com/lxml/lxml/releases/tag/lxml-4.7.1 but it's not on pypi yet

@scoder
Copy link
Member Author

@scoder scoder commented on 745ac26 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you maybe try one of those wheels? I changed the place where some header files are stored, so there is a slight chance that I broke something else.

@graingert
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually quite tricky to pin a specific wheel when using pip install xmlsec I'll see what I can do

@scoder
Copy link
Member Author

@scoder scoder commented on 745ac26 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you just pass it as a second parameter on the command line? (Ok, you probably tried that…)

@scoder
Copy link
Member Author

@scoder scoder commented on 745ac26 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xmlsec just normally calls lxml.get_include() in its setup.py. That adds one more include directory now, to include also the headers of zlib and iconv. I think it should still work ok.

@scoder
Copy link
Member Author

@scoder scoder commented on 745ac26 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've started uploading the release.

Please sign in to comment.