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

Better handling of path related environment variables in setup.py #329

Closed
nu774 opened this issue Sep 19, 2013 · 2 comments
Closed

Better handling of path related environment variables in setup.py #329

nu774 opened this issue Sep 19, 2013 · 2 comments

Comments

@nu774
Copy link
Contributor

nu774 commented Sep 19, 2013

Both of C_INCLUDE_PATH, LD_RUN_PATH are actually colon separated lists of multiple paths, but setup.py doesn't take it into account.
Similarly, MSVC uses INCLUDE and LIB environment variables for the same purpose (but with semi-colon as separator), and it's better to be supported for win32 build.
The following patch takes care of all of them.

         # include, rpath, if set as environment variables:
-        if os.environ.get('C_INCLUDE_PATH'):
-            _add_directory(include_dirs, os.environ.get('C_INCLUDE_PATH'))
-        if os.environ.get('LD_RUN_PATH'):
-            _add_directory(library_dirs, os.environ.get('LD_RUN_PATH'))
+        for k in 'C_INCLUDE_PATH INCLUDE'.split():
+            if k in os.environ:
+                for d in os.environ[k].split(os.path.pathsep):
+                    _add_directory(include_dirs, d)
+
+        for k in 'LD_RUN_PATH LIBRARY_PATH LIB'.split():
+            if k in os.environ:
+                for d in os.environ[k].split(os.path.pathsep):
+                    _add_directory(library_dirs, d)

         prefix = sysconfig.get_config_var("prefix")
 
@aclark4life
Copy link
Member

Can you send a pull request?

@aclark4life
Copy link
Member

Fixed in 5881d67

radarhere added a commit to radarhere/Pillow that referenced this issue Sep 24, 2023
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

No branches or pull requests

2 participants