Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.ip.flandmark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.ip.flandmark
Commits
84ac43e7
Commit
84ac43e7
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Updated bootstrap file
parent
09c9a8a4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bootstrap-buildout.py
+38
-17
38 additions, 17 deletions
bootstrap-buildout.py
with
38 additions
and
17 deletions
bootstrap-buildout.py
+
38
−
17
View file @
84ac43e7
...
@@ -25,7 +25,10 @@ import tempfile
...
@@ -25,7 +25,10 @@ import tempfile
from
optparse
import
OptionParser
from
optparse
import
OptionParser
tmpeggs
=
tempfile
.
mkdtemp
()
__version__
=
'
2015-07-01
'
# See zc.buildout's changelog if this version is up to date.
tmpeggs
=
tempfile
.
mkdtemp
(
prefix
=
'
bootstrap-
'
)
usage
=
'''
\
usage
=
'''
\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
...
@@ -40,13 +43,14 @@ this script from going over the network.
...
@@ -40,13 +43,14 @@ this script from going over the network.
'''
'''
parser
=
OptionParser
(
usage
=
usage
)
parser
=
OptionParser
(
usage
=
usage
)
parser
.
add_option
(
"
-v
"
,
"
--version
"
,
help
=
"
use a specific zc.buildout version
"
)
parser
.
add_option
(
"
--version
"
,
action
=
"
store_true
"
,
default
=
False
,
help
=
(
"
Return bootstrap.py version.
"
))
parser
.
add_option
(
"
-t
"
,
"
--accept-buildout-test-releases
"
,
parser
.
add_option
(
"
-t
"
,
"
--accept-buildout-test-releases
"
,
dest
=
'
accept_buildout_test_releases
'
,
dest
=
'
accept_buildout_test_releases
'
,
action
=
"
store_true
"
,
default
=
False
,
action
=
"
store_true
"
,
default
=
False
,
help
=
(
"
Normally, if you do not specify a --version,
the
"
help
=
(
"
Normally, if you do not specify a --
buildout-
version,
"
"
bootstrap script and buildout gets the newest
"
"
the
bootstrap script and buildout gets the newest
"
"
*final* versions of zc.buildout and its recipes and
"
"
*final* versions of zc.buildout and its recipes and
"
"
extensions for you. If you use this flag,
"
"
extensions for you. If you use this flag,
"
"
bootstrap and buildout will get the newest releases
"
"
bootstrap and buildout will get the newest releases
"
...
@@ -59,25 +63,33 @@ parser.add_option("-f", "--find-links",
...
@@ -59,25 +63,33 @@ parser.add_option("-f", "--find-links",
parser
.
add_option
(
"
--allow-site-packages
"
,
parser
.
add_option
(
"
--allow-site-packages
"
,
action
=
"
store_true
"
,
default
=
False
,
action
=
"
store_true
"
,
default
=
False
,
help
=
(
"
Let bootstrap.py use existing site packages
"
))
help
=
(
"
Let bootstrap.py use existing site packages
"
))
parser
.
add_option
(
"
--buildout-version
"
,
help
=
"
Use a specific zc.buildout version
"
)
parser
.
add_option
(
"
--setuptools-version
"
,
parser
.
add_option
(
"
--setuptools-version
"
,
help
=
"
use a specific setuptools version
"
)
help
=
"
Use a specific setuptools version
"
)
parser
.
add_option
(
"
--setuptools-to-dir
"
,
help
=
(
"
Allow for re-use of existing directory of
"
"
setuptools versions
"
))
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
if
options
.
version
:
print
(
"
bootstrap.py version %s
"
%
__version__
)
sys
.
exit
(
0
)
######################################################################
######################################################################
# 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
ez
=
{}
ez
=
{}
exec
(
urlopen
(
'
https://bootstrap.pypa.io/ez_setup.py
'
).
read
(),
ez
)
if
os
.
path
.
exists
(
'
ez_setup.py
'
):
exec
(
open
(
'
ez_setup.py
'
).
read
(),
ez
)
else
:
exec
(
urlopen
(
'
https://bootstrap.pypa.io/ez_setup.py
'
).
read
(),
ez
)
if
not
options
.
allow_site_packages
:
if
not
options
.
allow_site_packages
:
# ez_setup imports site, which adds site packages
# ez_setup imports site, which adds site packages
...
@@ -88,12 +100,19 @@ if not options.allow_site_packages:
...
@@ -88,12 +100,19 @@ if not options.allow_site_packages:
# We can't remove these reliably
# We can't remove these reliably
if
hasattr
(
site
,
'
getsitepackages
'
):
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
]
# Strip all site-packages directories from sys.path that
# are not sys.prefix; this is because on Windows
# sys.prefix is a site-package directory.
if
sitepackage_path
!=
sys
.
prefix
:
sys
.
path
[:]
=
[
x
for
x
in
sys
.
path
if
sitepackage_path
not
in
x
]
setup_args
=
dict
(
to_dir
=
tmpeggs
,
download_delay
=
0
)
setup_args
=
dict
(
to_dir
=
tmpeggs
,
download_delay
=
0
)
if
options
.
setuptools_version
is
not
None
:
if
options
.
setuptools_version
is
not
None
:
setup_args
[
'
version
'
]
=
options
.
setuptools_version
setup_args
[
'
version
'
]
=
options
.
setuptools_version
if
options
.
setuptools_to_dir
is
not
None
:
setup_args
[
'
to_dir
'
]
=
options
.
setuptools_to_dir
ez
[
'
use_setuptools
'
](
**
setup_args
)
ez
[
'
use_setuptools
'
](
**
setup_args
)
import
setuptools
import
setuptools
...
@@ -110,7 +129,12 @@ for path in sys.path:
...
@@ -110,7 +129,12 @@ for path in sys.path:
ws
=
pkg_resources
.
working_set
ws
=
pkg_resources
.
working_set
setuptools_path
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'
setuptools
'
)).
location
# Fix sys.path here as easy_install.pth added before PYTHONPATH
cmd
=
[
sys
.
executable
,
'
-c
'
,
cmd
=
[
sys
.
executable
,
'
-c
'
,
'
import sys; sys.path[0:0] = [%r];
'
%
setuptools_path
+
'
from setuptools.command.easy_install import main; main()
'
,
'
from setuptools.command.easy_install import main; main()
'
,
'
-mZqNxd
'
,
tmpeggs
]
'
-mZqNxd
'
,
tmpeggs
]
...
@@ -123,11 +147,8 @@ find_links = os.environ.get(
...
@@ -123,11 +147,8 @@ find_links = os.environ.get(
if
find_links
:
if
find_links
:
cmd
.
extend
([
'
-f
'
,
find_links
])
cmd
.
extend
([
'
-f
'
,
find_links
])
setuptools_path
=
ws
.
find
(
pkg_resources
.
Requirement
.
parse
(
'
setuptools
'
)).
location
requirement
=
'
zc.buildout
'
requirement
=
'
zc.buildout
'
version
=
options
.
version
version
=
options
.
buildout_
version
if
version
is
None
and
not
options
.
accept_buildout_test_releases
:
if
version
is
None
and
not
options
.
accept_buildout_test_releases
:
# Figure out the most recent final version of zc.buildout.
# Figure out the most recent final version of zc.buildout.
import
setuptools.package_index
import
setuptools.package_index
...
@@ -167,7 +188,7 @@ if version:
...
@@ -167,7 +188,7 @@ if version:
cmd
.
append
(
requirement
)
cmd
.
append
(
requirement
)
import
subprocess
import
subprocess
if
subprocess
.
call
(
cmd
,
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
setuptools_path
)
)
!=
0
:
if
subprocess
.
call
(
cmd
)
!=
0
:
raise
Exception
(
raise
Exception
(
"
Failed to execute command:
\n
%s
"
%
repr
(
cmd
)[
1
:
-
1
])
"
Failed to execute command:
\n
%s
"
%
repr
(
cmd
)[
1
:
-
1
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment