Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.buildout
Commits
682dd5a6
Commit
682dd5a6
authored
Jul 20, 2013
by
Yusuke Tsutsumi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding allow-site-packages to allow for site package imports
parent
c8a43f4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
bootstrap/bootstrap.py
bootstrap/bootstrap.py
+16
-9
No files found.
bootstrap/bootstrap.py
View file @
682dd5a6
...
@@ -56,6 +56,9 @@ parser.add_option("-c", "--config-file",
...
@@ -56,6 +56,9 @@ parser.add_option("-c", "--config-file",
"file to be used."
))
"file to be used."
))
parser
.
add_option
(
"-f"
,
"--find-links"
,
parser
.
add_option
(
"-f"
,
"--find-links"
,
help
=
(
"Specify a URL to search for buildout releases"
))
help
=
(
"Specify a URL to search for buildout releases"
))
parser
.
add_option
(
"--allow-site-packages"
,
action
=
"store_true"
,
default
=
False
,
help
=
(
"Let bootstrap.py use existing site packages"
))
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
...
@@ -64,6 +67,9 @@ options, args = parser.parse_args()
...
@@ -64,6 +67,9 @@ options, args = parser.parse_args()
# load/install setuptools
# load/install setuptools
try
:
try
:
if
options
.
allow_site_packages
:
import
setuptools
import
pkg_resources
from
urllib.request
import
urlopen
from
urllib.request
import
urlopen
except
ImportError
:
except
ImportError
:
from
urllib2
import
urlopen
from
urllib2
import
urlopen
...
@@ -71,13 +77,14 @@ except ImportError:
...
@@ -71,13 +77,14 @@ except ImportError:
ez
=
{}
ez
=
{}
exec
(
urlopen
(
'https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py'
exec
(
urlopen
(
'https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py'
).
read
(),
ez
)
).
read
(),
ez
)
# ez_setup imports site, which adds site packages
if
not
options
.
allow_site_packages
:
# this will remove them from the path to ensure that incompatible versions
# ez_setup imports site, which adds site packages
# of setuptools are not in the path
# this will remove them from the path to ensure that incompatible versions
import
site
# of setuptools are not in the path
# inside a virtualenv, there is no 'getsitepackages'.
import
site
# We can't remove these reliably
# inside a virtualenv, there is no 'getsitepackages'.
if
hasattr
(
site
,
'getsitepackages'
):
# We can't remove these reliably
if
hasattr
(
site
,
'getsitepackages'
):
for
sitepackage_path
in
site
.
getsitepackages
():
for
sitepackage_path
in
site
.
getsitepackages
():
sys
.
path
[:]
=
[
x
for
x
in
sys
.
path
if
sitepackage_path
not
in
x
]
sys
.
path
[:]
=
[
x
for
x
in
sys
.
path
if
sitepackage_path
not
in
x
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment