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

Comments

Projects
None yet
2 participants
@nu774
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Sep 27, 2013

Can you send a pull request?

@aclark4life

This comment has been minimized.

Copy link
Member

commented Sep 27, 2013

Fixed in 5881d67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.