-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5227a9
commit 8cbd8a1
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import os | ||
import sys | ||
import site | ||
from distutils.sysconfig import get_python_lib | ||
|
||
if __name__ == '__main__': | ||
prefix = sys.argv[1] | ||
|
||
#ask distutils where to install the python module | ||
install_dir = get_python_lib(plat_specific=True, prefix=prefix) | ||
|
||
#use sites when the prefix is already recognized | ||
try: | ||
paths = [p for p in site.getsitepackages() if p.startswith(prefix)] | ||
if len(paths) == 1: install_dir = paths[0] | ||
except AttributeError: pass | ||
|
||
#strip the prefix to return a relative path | ||
print(os.path.relpath(install_dir, prefix)) |