diff options
author | Isaac Jurado <diptongo@gmail.com> | 2021-05-19 09:50:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-19 09:50:53 +0200 |
commit | c9cf865d2e5f4ea4952d0ea6d4e0e2e2120649b7 (patch) | |
tree | 75f4d3d91c4bfde81ac5916cde1d5fb1135a2c8f | |
parent | 450487092251816b4252a0e8694bf50abb1d4046 (diff) | |
download | python-lxml-c9cf865d2e5f4ea4952d0ea6d4e0e2e2120649b7.tar.gz |
Allow passing STATIC_* setup variables from the environment. (GH-314)
For very customized static builds of lxml, the only way to succeed is by patching the setup.py file. This change makes it a little more convenient to make static builds directly from the pip command line.
-rw-r--r-- | setup.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -25,10 +25,13 @@ import setupinfo # override these and pass --static for a static build. See # doc/build.txt for more information. If you do not pass --static # changing this will have no effect. -STATIC_INCLUDE_DIRS = [] -STATIC_LIBRARY_DIRS = [] -STATIC_CFLAGS = [] -STATIC_BINARIES = [] +def static_env_list(name, separator=None): + return [x.strip() for x in os.environ.get(name, "").split(separator) if x.strip()] + +STATIC_INCLUDE_DIRS = static_env_list("LXML_STATIC_INCLUDE_DIRS", separator=os.pathsep) +STATIC_LIBRARY_DIRS = static_env_list("LXML_STATIC_LIBRARY_DIRS", separator=os.pathsep) +STATIC_CFLAGS = static_env_list("LXML_STATIC_CFLAGS") +STATIC_BINARIES = static_env_list("LXML_STATIC_BINARIES", separator=os.pathsep) # create lxml-version.h file versioninfo.create_version_h() |