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
Łukasz Nowak
slapos.buildout
Commits
fa2f850d
Commit
fa2f850d
authored
Mar 19, 2015
by
Laurence Rowe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use local ez_setup.py if one exists; add --setuptools-to-dir option to reuse setuptools downloads.
parent
88ad9f41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
bootstrap/bootstrap.py
bootstrap/bootstrap.py
+9
-2
src/zc/buildout/bootstrap.txt
src/zc/buildout/bootstrap.txt
+32
-0
No files found.
bootstrap/bootstrap.py
View file @
fa2f850d
...
@@ -61,7 +61,9 @@ parser.add_option("--allow-site-packages",
...
@@ -61,7 +61,9 @@ parser.add_option("--allow-site-packages",
help
=
(
"Let bootstrap.py use existing site packages"
))
help
=
(
"Let bootstrap.py use existing site packages"
))
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
()
...
@@ -77,7 +79,10 @@ except ImportError:
...
@@ -77,7 +79,10 @@ 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
...
@@ -94,6 +99,8 @@ setup_args = dict(to_dir=tmpeggs, download_delay=0)
...
@@ -94,6 +99,8 @@ 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
...
...
src/zc/buildout/bootstrap.txt
View file @
fa2f850d
...
@@ -127,3 +127,35 @@ Let's make sure the generated `buildout` script uses it::
...
@@ -127,3 +127,35 @@ Let's make sure the generated `buildout` script uses it::
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
]...
]...
For a completely offline install we want to avoid downloading ez_setup.py,
specify the setuptools version, and to reuse the setuptools zipfile.
>>> try:
... from urllib.request import urlopen
... except ImportError:
... from urllib2 import urlopen
>>> ez_setup = urlopen('https://bootstrap.pypa.io/ez_setup.py').read()
>>> write('ez_setup.py',
... '''print("Using local ez_setup.py")
... ''' + ez_setup.decode('ascii'))
>>> os.path.exists('setuptools-14.3.zip')
False
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --setuptools-version 14.3 --version 2.0.0 '+
... '--setuptools-to-dir .')); print_('X')
... # doctest: +ELLIPSIS
X...Using local ez_setup.py...Generated script '/sample/bin/buildout'...X
>>> os.path.exists('setuptools-14.3.zip')
True
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/setuptools-14.3...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
]...
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