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
Boxiang Sun
slapos.buildout
Commits
6f9fb57a
Commit
6f9fb57a
authored
Jan 29, 2017
by
Jim Fulton
Committed by
GitHub
Jan 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #323 from buildout/setuptools-has-dependencies
Update to work with setuptools 34
parents
d05717a2
2647b182
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
167 additions
and
112 deletions
+167
-112
CHANGES.rst
CHANGES.rst
+1
-2
Makefile
Makefile
+7
-3
buildout.cfg
buildout.cfg
+1
-1
src/zc/buildout/allowhosts.txt
src/zc/buildout/allowhosts.txt
+3
-3
src/zc/buildout/bootstrap.txt
src/zc/buildout/bootstrap.txt
+8
-8
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+4
-9
src/zc/buildout/buildout.txt
src/zc/buildout/buildout.txt
+18
-2
src/zc/buildout/downloadcache.txt
src/zc/buildout/downloadcache.txt
+2
-2
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+63
-61
src/zc/buildout/repeatable.txt
src/zc/buildout/repeatable.txt
+16
-0
src/zc/buildout/testing.py
src/zc/buildout/testing.py
+4
-4
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+21
-12
src/zc/buildout/update.txt
src/zc/buildout/update.txt
+5
-0
zc.recipe.egg_/src/zc/recipe/egg/README.rst
zc.recipe.egg_/src/zc/recipe/egg/README.rst
+9
-0
zc.recipe.egg_/src/zc/recipe/egg/api.rst
zc.recipe.egg_/src/zc/recipe/egg/api.rst
+1
-4
zc.recipe.egg_/src/zc/recipe/egg/custom.rst
zc.recipe.egg_/src/zc/recipe/egg/custom.rst
+1
-1
zc.recipe.egg_/src/zc/recipe/egg/tests.py
zc.recipe.egg_/src/zc/recipe/egg/tests.py
+3
-0
No files found.
CHANGES.rst
View file @
6f9fb57a
...
...
@@ -4,8 +4,7 @@ Change History
2.6.0
(
unreleased
)
==================
-
Nothing
changed
yet
.
-
Updated
to
work
with
the
latest
setuptools
.
2.5.3
(
2016
-
09
-
05
)
==================
...
...
Makefile
View file @
6f9fb57a
...
...
@@ -4,14 +4,18 @@ PYTHON_PATH = $(HERE)/pythons/$(PYTHON_VER)
PYTHON_BUILD_DIR
=
$(HERE)
/python_builds
ifeq
($(PYTHON_VER),2.7)
PYTHON_MINOR
?=
2.7.1
1
PYTHON_MINOR
?=
2.7.1
3
endif
ifeq
($(PYTHON_VER),3.4)
PYTHON_MINOR
?=
3.4.
4
PYTHON_MINOR
?=
3.4.
6
PYTHON_CONFIGURE_ARGS
?=
--without-ensurepip
endif
ifeq
($(PYTHON_VER),3.5)
PYTHON_MINOR
?=
3.5.2
PYTHON_MINOR
?=
3.5.3
PYTHON_CONFIGURE_ARGS
?=
--without-ensurepip
endif
ifeq
($(PYTHON_VER),3.6)
PYTHON_MINOR
?=
3.6.0
PYTHON_CONFIGURE_ARGS
?=
--without-ensurepip
endif
...
...
buildout.cfg
View file @
6f9fb57a
...
...
@@ -11,7 +11,7 @@ zope.testing = 4.5.0
[py]
recipe = zc.recipe.egg
eggs = zc.buildout
eggs = zc.buildout
[test]
zc.recipe.egg
zope.testing
interpreter = py
...
...
src/zc/buildout/allowhosts.txt
View file @
6f9fb57a
...
...
@@ -98,7 +98,8 @@ Now we can run the buildout and make sure all attempts to dist.plone.org fails::
Test for issues
---------------
Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212::
Test for 1.0.5 breakage as in
https://bugs.launchpad.net/zc.buildout/+bug/239212::
>>> write(sample_buildout, 'buildout.cfg',
... '''
...
...
@@ -114,8 +115,7 @@ Test for 1.0.5 breakage as in https://bugs.launchpad.net/zc.buildout/+bug/239212
>>> print_('XX'); print_(system(buildout), end='') # doctest: +ELLIPSIS
X...
Unused options for buildout: 'foo'.
Installing python.
Generated script '/sample-buildout/bin/buildout'.
Installing python...
Generated interpreter '/sample-buildout/bin/python'.
The bug 239212 above would have got us an *AttributeError* on
...
...
src/zc/buildout/bootstrap.txt
View file @
6f9fb57a
...
...
@@ -55,8 +55,8 @@ By default it gets the latest version::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-22.0.0...egg',
'/sample/eggs/setuptools-...egg'...
]...
Now trying the ``--buildout-version`` option, that let you define a version
...
...
@@ -86,18 +86,18 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/setuptools-...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/setuptools-...egg'...
]...
Now trying the ``--setuptools-version`` option, that lets you define a version
for ``setuptools``.
Now let's try with ``
8.0
``, which happens to exist::
Now let's try with ``
33.1.1
``, which happens to exist::
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --setuptools-version
8.0
')); print_('X')
... 'bootstrap.py --setuptools-version
33.1.1
')); print_('X')
... # doctest: +ELLIPSIS
X...Generated script '/sample/bin/buildout'...X
...
...
@@ -106,8 +106,8 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/zc.buildout-...egg',
'/sample/eggs/setuptools-33.1.1...egg'...
]...
Now let's try specifying both ``zc.buildout`` and ``setuptools`` to versions
...
...
@@ -115,7 +115,7 @@ which happens to exist::
>>> print_('X'); print_(system(
... zc.buildout.easy_install._safe_arg(sys.executable)+' '+
... 'bootstrap.py --setuptools-version
8.0
--buildout-version 2.0.0')); print_('X')
... 'bootstrap.py --setuptools-version
33.1.1
--buildout-version 2.0.0')); print_('X')
... # doctest: +ELLIPSIS
X...Generated script '/sample/bin/buildout'...X
...
...
@@ -124,8 +124,8 @@ Let's make sure the generated ``buildout`` script uses it::
>>> print_(open(buildout_script).read()) # doctest: +ELLIPSIS
#...
sys.path[0:0] = [
'/sample/eggs/setuptools-8.0...egg',
'/sample/eggs/zc.buildout-2.0.0...egg',
'/sample/eggs/setuptools-33.1.1...egg'...
]...
For a completely offline install we want to avoid downloading ``ez_setup.py``,
...
...
@@ -156,8 +156,8 @@ specify the setuptools version, and to reuse the setuptools zipfile::
>>> 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',
'/sample/eggs/setuptools-14.3...egg'...
]...
You can ask ``bootstrap.py`` for its version. This is really the day the last
...
...
src/zc/buildout/buildout.py
View file @
6f9fb57a
...
...
@@ -61,9 +61,6 @@ def print_(*args, **kw):
realpath
=
zc
.
buildout
.
easy_install
.
realpath
pkg_resources_loc
=
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)).
location
_isurl
=
re
.
compile
(
'([a-zA-Z0-9+.-]+)://'
).
match
class
MissingOption
(
zc
.
buildout
.
UserError
,
KeyError
):
...
...
@@ -435,12 +432,10 @@ class Buildout(DictMixin):
# Now copy buildout and setuptools eggs, and record destination eggs:
entries
=
[]
for
name
in
'setuptools'
,
'zc.buildout'
:
r
=
pkg_resources
.
Requirement
.
parse
(
name
)
dist
=
pkg_resources
.
working_set
.
find
(
r
)
for
dist
in
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
:
if
dist
.
precedence
==
pkg_resources
.
DEVELOP_DIST
:
dest
=
os
.
path
.
join
(
self
[
'buildout'
][
'develop-eggs-directory'
],
name
+
'.egg-link'
)
dist
.
key
+
'.egg-link'
)
open
(
dest
,
'w'
).
write
(
dist
.
location
)
entries
.
append
(
dist
.
location
)
else
:
...
...
@@ -752,7 +747,8 @@ class Buildout(DictMixin):
dest
=
self
[
'buildout'
][
'develop-eggs-directory'
]
old_files
=
os
.
listdir
(
dest
)
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
pkg_resources_loc
)
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
zc
.
buildout
.
easy_install
.
setuptools_pythonpath
)
here
=
os
.
getcwd
()
try
:
try
:
...
...
@@ -1090,7 +1086,6 @@ class Buildout(DictMixin):
fd
,
tsetup
=
tempfile
.
mkstemp
()
try
:
os
.
write
(
fd
,
(
zc
.
buildout
.
easy_install
.
runsetup_template
%
dict
(
setuptools
=
pkg_resources_loc
,
setupdir
=
os
.
path
.
dirname
(
setup
),
setup
=
setup
,
__file__
=
setup
,
...
...
src/zc/buildout/buildout.txt
View file @
6f9fb57a
...
...
@@ -52,8 +52,12 @@ The ``bin`` directory contains scripts::
>>> ls(sample_buildout, 'bin')
- buildout
The ``eggs`` directory has installed distributions:
>>> ls(sample_buildout, 'eggs')
d...
- setuptools-0.7-py3.3.egg
...
- zc.buildout.egg-link
The ``develop-eggs`` and ``parts`` directories are initially empty::
...
...
@@ -1138,6 +1142,17 @@ relative to the ``myfiles`` section.
though ``<=`` may look like a new operator, it's still just the familiar
``key = value`` syntax.
.. cleanup buildout
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... develop = recipes
... parts =
... """)
>>> _ = system(buildout)
Extending sections (macros) - Adding and removing options
---------------------------------------------------------
...
...
@@ -1202,7 +1217,6 @@ Set up a buildout configuration for this extension.
>>> os.chdir(sample_buildout)
>>> print_(system(os.path.join(sample_buildout, 'bin', 'buildout')), end='') # doctest: +ELLIPSIS
Develop: '/sample-buildout/demo'
....
Verify option values.
...
...
@@ -2645,7 +2659,7 @@ database is shown::
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7
<BLANKLINE>
...
Configuration data:
[buildout]
allow-hosts = *
...
...
@@ -2901,7 +2915,9 @@ We also get other buildout artifacts::
>>> _ = (ls(sample_bootstrapped, 'eggs'),
... ls(sample_bootstrapped, 'develop-eggs'))
d...
- setuptools-0.7-py2.3.egg
...
- zc.buildout-1.0-py2.3.egg
(We list both the ``eggs`` and ``develop-eggs`` directories because the
...
...
src/zc/buildout/downloadcache.txt
View file @
6f9fb57a
...
...
@@ -59,7 +59,7 @@ If we run the buildout, we'll see the eggs installed from the link
server as usual:
>>> print_(system(buildout), end='')
GET
200 /
GET
...
GET 200 /demo-0.2-py2.4.egg
GET 200 /demoneeded-1.1.zip
Installing eggs.
...
...
@@ -89,7 +89,7 @@ If we remove the installed eggs from eggs directory and re-run the buildout:
... remove('eggs', f)
>>> print_(system(buildout), end='')
GET
200 /
GET
...
Updating eggs.
Getting distribution for 'demo==0.2'.
Got demo 0.2.
...
...
src/zc/buildout/easy_install.py
View file @
6f9fb57a
...
...
@@ -74,16 +74,11 @@ if has_distribute and not has_setuptools:
" you have the latest version downloaded from"
" https://bootstrap.pypa.io/bootstrap-buildout.py"
)
setuptools_loc
=
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)
).
location
# Include buildout and setuptools eggs in paths
buildout_and_setuptools_path
=
[
setuptools_loc
,
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'zc.buildout'
)).
location
,
]
# Include buildout and setuptools eggs in paths. We get this
# initially from the entire working set. Later, we'll use the install
# function to narrow to just the buildout and setuptools paths.
buildout_and_setuptools_path
=
[
d
.
location
for
d
in
pkg_resources
.
working_set
]
setuptools_path
=
buildout_and_setuptools_path
FILE_SCHEME
=
re
.
compile
(
'file://'
,
re
.
I
).
match
DUNDER_FILE_PATTERN
=
re
.
compile
(
r"__file__ = '(?P<filename>.+)'$"
)
...
...
@@ -208,7 +203,7 @@ class Installer:
if
use_dependency_links
is
not
None
:
self
.
_use_dependency_links
=
use_dependency_links
self
.
_links
=
links
=
list
(
_fix_file_links
(
links
))
self
.
_links
=
links
=
list
(
self
.
_fix_file_links
(
links
))
if
self
.
_download_cache
and
(
self
.
_download_cache
not
in
links
):
links
.
insert
(
0
,
self
.
_download_cache
)
...
...
@@ -269,7 +264,7 @@ class Installer:
if
self
.
_prefer_final
:
fdists
=
[
dist
for
dist
in
dists
if
_final_version
(
dist
.
parsed_version
)
if
self
.
_final_version
(
dist
.
parsed_version
)
]
if
fdists
:
# There are final dists, so only use those
...
...
@@ -300,8 +295,8 @@ class Installer:
return
best_we_have
,
None
if
self
.
_prefer_final
:
if
_final_version
(
best_available
.
parsed_version
):
if
_final_version
(
best_we_have
.
parsed_version
):
if
self
.
_final_version
(
best_available
.
parsed_version
):
if
self
.
_final_version
(
best_we_have
.
parsed_version
):
if
(
best_we_have
.
parsed_version
<
best_available
.
parsed_version
...
...
@@ -310,7 +305,7 @@ class Installer:
else
:
return
None
,
best_available
else
:
if
(
not
_final_version
(
best_we_have
.
parsed_version
)
if
(
not
self
.
_final_version
(
best_we_have
.
parsed_version
)
and
(
best_we_have
.
parsed_version
<
...
...
@@ -339,10 +334,10 @@ class Installer:
tmp
=
tempfile
.
mkdtemp
(
dir
=
dest
)
try
:
path
=
setuptools_
loc
path
=
setuptools_
path
args
=
[
sys
.
executable
,
'-c'
,
(
'import sys; sys.path[0:0] =
[%r]
; '
%
path
)
+
(
'import sys; sys.path[0:0] =
%r
; '
%
path
)
+
_easy_install_cmd
,
'-mZUNxd'
,
tmp
]
level
=
logger
.
getEffectiveLevel
()
if
level
>
0
:
...
...
@@ -428,7 +423,7 @@ class Installer:
# result if it is non empty.
if
self
.
_prefer_final
:
fdists
=
[
dist
for
dist
in
dists
if
_final_version
(
dist
.
parsed_version
)
if
self
.
_final_version
(
dist
.
parsed_version
)
]
if
fdists
:
# There are final dists, so only use those
...
...
@@ -688,7 +683,7 @@ class Installer:
logger
.
debug
(
'Getting required %r'
,
str
(
req
))
else
:
logger
.
debug
(
'Adding required %r'
,
str
(
req
))
_log_requirement
(
ws
,
req
)
self
.
_log_requirement
(
ws
,
req
)
for
dist
in
self
.
_get_dist
(
req
,
ws
,
for_buildout_run
=
for_buildout_run
):
ws
.
add
(
dist
)
...
...
@@ -703,7 +698,8 @@ class Installer:
extra_requirements
=
dist
.
requires
(
req
.
extras
)[::
-
1
]
for
extra_requirement
in
extra_requirements
:
self
.
_requirements_and_constraints
.
append
(
"Requirement of %s: %s"
%
(
current_requirement
,
extra_requirement
))
"Requirement of %s: %s"
%
(
current_requirement
,
extra_requirement
))
requirements
.
extend
(
extra_requirements
)
processed
[
req
]
=
True
...
...
@@ -779,6 +775,38 @@ class Installer:
if
tmp
!=
self
.
_download_cache
:
shutil
.
rmtree
(
tmp
)
def
_fix_file_links
(
self
,
links
):
for
link
in
links
:
if
link
.
startswith
(
'file://'
)
and
link
[
-
1
]
!=
'/'
:
if
os
.
path
.
isdir
(
link
[
7
:]):
# work around excessive restriction in setuptools:
link
+=
'/'
yield
link
def
_log_requirement
(
self
,
ws
,
req
):
if
(
not
logger
.
isEnabledFor
(
logging
.
DEBUG
)
and
not
Installer
.
_store_required_by
):
# Sorting the working set and iterating over it's requirements
# is expensive, so short circuit the work if it won't even be
# logged. When profiling a simple buildout with 10 parts with
# identical and large working sets, this resulted in a
# decrease of run time from 93.411 to 15.068 seconds, about a
# 6 fold improvement.
return
ws
=
list
(
ws
)
ws
.
sort
()
for
dist
in
ws
:
if
req
in
dist
.
requires
():
logger
.
debug
(
" required by %s."
%
dist
)
req_
=
str
(
req
)
if
req_
not
in
Installer
.
_required_by
:
Installer
.
_required_by
[
req_
]
=
set
()
Installer
.
_required_by
[
req_
].
add
(
str
(
dist
.
as_requirement
()))
def
_final_version
(
self
,
parsed_version
):
return
not
parsed_version
.
is_prerelease
def
normalize_versions
(
versions
):
"""Return version dict with keys normalized to lowercase.
...
...
@@ -858,6 +886,12 @@ def install(specs, dest,
allow_hosts
=
allow_hosts
)
return
installer
.
install
(
specs
,
working_set
)
buildout_and_setuptools_dists
=
list
(
install
([
'zc.buildout'
],
None
))
buildout_and_setuptools_path
=
[
d
.
location
for
d
in
buildout_and_setuptools_dists
]
setuptools_path
=
[
d
.
location
for
d
in
install
([
'setuptools'
],
None
)]
setuptools_pythonpath
=
os
.
pathsep
.
join
(
setuptools_path
)
def
build
(
spec
,
dest
,
build_ext
,
links
=
(),
index
=
None
,
...
...
@@ -973,7 +1007,6 @@ def develop(setup, dest,
undo
.
append
(
lambda
:
os
.
close
(
fd
))
os
.
write
(
fd
,
(
runsetup_template
%
dict
(
setuptools
=
setuptools_loc
,
setupdir
=
directory
,
setup
=
setup
,
__file__
=
setup
,
...
...
@@ -1016,6 +1049,7 @@ def working_set(specs, executable, path=None,
return
install
(
specs
,
None
,
path
=
path
)
def
scripts
(
reqs
,
working_set
,
executable
,
dest
=
None
,
scripts
=
None
,
extra_paths
=
(),
...
...
@@ -1396,19 +1430,19 @@ if _interactive:
runsetup_template
=
"""
import sys
sys.path.insert(0, %(setupdir)r)
sys.path
.insert(0, %(setuptools)r)
sys.path.insert(0, %
%
(setupdir)r)
sys.path
[0:0] = %r
import os, setuptools
__file__ = %(__file__)r
__file__ = %
%
(__file__)r
os.chdir(%(setupdir)r)
sys.argv[0] = %(setup)r
os.chdir(%
%
(setupdir)r)
sys.argv[0] = %
%
(setup)r
with open(%(setup)r, 'U') as f:
exec(compile(f.read(), %(setup)r, 'exec'))
"""
with open(%
%
(setup)r, 'U') as f:
exec(compile(f.read(), %
%
(setup)r, 'exec'))
"""
%
setuptools_path
class
VersionConflict
(
zc
.
buildout
.
UserError
):
...
...
@@ -1443,38 +1477,6 @@ class MissingDistribution(zc.buildout.UserError):
req
,
ws
=
self
.
data
return
"Couldn't find a distribution for %r."
%
str
(
req
)
def
_log_requirement
(
ws
,
req
):
if
(
not
logger
.
isEnabledFor
(
logging
.
DEBUG
)
and
not
Installer
.
_store_required_by
):
# Sorting the working set and iterating over it's requirements
# is expensive, so short circuit the work if it won't even be
# logged. When profiling a simple buildout with 10 parts with
# identical and large working sets, this resulted in a
# decrease of run time from 93.411 to 15.068 seconds, about a
# 6 fold improvement.
return
ws
=
list
(
ws
)
ws
.
sort
()
for
dist
in
ws
:
if
req
in
dist
.
requires
():
logger
.
debug
(
" required by %s."
%
dist
)
req_
=
str
(
req
)
if
req_
not
in
Installer
.
_required_by
:
Installer
.
_required_by
[
req_
]
=
set
()
Installer
.
_required_by
[
req_
].
add
(
str
(
dist
.
as_requirement
()))
def
_fix_file_links
(
links
):
for
link
in
links
:
if
link
.
startswith
(
'file://'
)
and
link
[
-
1
]
!=
'/'
:
if
os
.
path
.
isdir
(
link
[
7
:]):
# work around excessive restriction in setuptools:
link
+=
'/'
yield
link
def
_final_version
(
parsed_version
):
return
not
parsed_version
.
is_prerelease
def
redo_pyc
(
egg
):
if
not
os
.
path
.
isdir
(
egg
):
return
...
...
src/zc/buildout/repeatable.txt
View file @
6f9fb57a
...
...
@@ -131,6 +131,7 @@ specifying a versions section:
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
...
Installing 'spam'.
We have the best distribution that satisfies 'spam'.
Picked: spam = 2.
...
...
@@ -153,6 +154,7 @@ If we run the buildout with the versions section:
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
...
Installing 'spam'.
We have the distribution that satisfies 'spam==1'.
Uninstalling foo.
...
...
@@ -184,6 +186,7 @@ versions for.
We have a develop egg: zc.buildout 1.0.0.
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.6
...
Installing 'spam >0'.
We have the distribution that satisfies 'spam==1'.
Uninstalling foo.
...
...
@@ -293,8 +296,11 @@ versions it picked at the end of its run:
Versions had to be automatically picked.
The following part definition lists the versions picked:
[versions]
...
setuptools = 0.6.99
...
spam = 2
...
When everything is pinned, no output is generated:
...
...
@@ -315,6 +321,7 @@ When everything is pinned, no output is generated:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
...
The Python package index is case-insensitive. Both
http://pypi.python.org/simple/Django/ and
...
...
@@ -339,6 +346,7 @@ and case differences won't impact the pinning:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
...
Sometimes it is handy to have a separate file with versions. This is a regular
buildout file with a single ``[versions]`` section. You include it by
...
...
@@ -364,6 +372,7 @@ extending from that versions file:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
...
If not everything is pinned and buildout has to pick versions, you can tell
buildout to append the versions to your versions file. It simply appends them
...
...
@@ -392,7 +401,9 @@ at the end.
Versions had to be automatically picked.
The following part definition lists the versions picked:
[versions]
...
spam = 2
...
Picked versions have been written to my_versions.cfg
The versions file now contains the extra pin:
...
...
@@ -402,14 +413,17 @@ The versions file now contains the extra pin:
...
<BLANKLINE>
# Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd
...
spam = 2
<BLANKLINE>
...
And re-running buildout doesn't report any picked versions anymore:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
Updating foo.
recipe v2
...
If you've enabled ``update-versions-file`` but not ``show-picked-versions``,
buildout will append the versions to your versions file anyway (without
...
...
@@ -444,8 +458,10 @@ The versions file contains the extra pin:
...
<BLANKLINE>
# Added by buildout at YYYY-MM-DD hh:mm:ss.dddddd
...
spam = 2
<BLANKLINE>
...
Because buildout now includes buildout-versions' (and part of the older
buildout.dumppickedversions') functionality, it warns if these extensions are
...
...
src/zc/buildout/testing.py
View file @
6f9fb57a
...
...
@@ -46,9 +46,6 @@ print_ = zc.buildout.buildout.print_
fsync
=
getattr
(
os
,
'fsync'
,
lambda
fileno
:
None
)
is_win32
=
sys
.
platform
==
'win32'
setuptools_location
=
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)).
location
def
cat
(
dir
,
*
names
):
path
=
os
.
path
.
join
(
dir
,
*
names
)
if
(
not
os
.
path
.
exists
(
path
)
...
...
@@ -149,7 +146,10 @@ def _runsetup(setup, *args):
os
.
chdir
(
os
.
path
.
dirname
(
setup
))
zc
.
buildout
.
easy_install
.
call_subprocess
(
[
sys
.
executable
,
setup
]
+
args
,
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
setuptools_location
))
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
zc
.
buildout
.
easy_install
.
setuptools_pythonpath
,
),
)
if
os
.
path
.
exists
(
'build'
):
rmtree
(
'build'
)
finally
:
...
...
src/zc/buildout/tests.py
View file @
6f9fb57a
...
...
@@ -341,6 +341,7 @@ If we use the verbose switch, we can see where requirements are coming from:
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7
...
Develop: '/sample-buildout/sampley'
Develop: '/sample-buildout/samplez'
Develop: '/sample-buildout/samplea'
...
...
@@ -464,6 +465,7 @@ We do not need to run in verbose mode for that to work:
Versions had to be automatically picked.
The following part definition lists the versions picked:
[versions]
...
<BLANKLINE>
# Required by:
# sampley==1
...
...
@@ -847,7 +849,9 @@ On the other hand, if we have a regular egg, rather than a develop egg:
- zc.recipe.egg.egg-link
>>> ls('eggs') # doctest: +ELLIPSIS
d...
- foox-0.0.0-py2.4.egg
...
d setuptools.eggpyN.N.egg
...
...
...
@@ -1747,6 +1751,7 @@ def install_source_dist_with_bad_py():
...
>>> ls('eggs') # doctest: +ELLIPSIS
d...
d badegg-1-py2.4.egg
...
...
...
@@ -2042,6 +2047,7 @@ def dealing_with_extremely_insane_dependencies():
We have a develop egg: zc.buildout 1.0.0
We have the best distribution that satisfies 'setuptools'.
Picked: setuptools = 0.7
...
Develop: '/sample-buildout/pack0'
Develop: '/sample-buildout/pack1'
Develop: '/sample-buildout/pack2'
...
...
@@ -2469,7 +2475,7 @@ Distribution setup scripts can import modules in the distribution directory:
"""
def
dont_pick_setuptools_if_version_is_specified_when_required_by_src_dist
():
"""
r
"""
When installing a source distribution, we got setuptools without
honoring our version specification.
...
...
@@ -2491,14 +2497,15 @@ honoring our version specification.
... allow-picked-versions = false
...
... [versions]
...
setuptools
= %s
...
wtf
= %s
... foo = 1
...
... [foo]
... recipe = zc.recipe.egg
... eggs = foo
... ''' % pkg_resources.working_set.find(
... pkg_resources.Requirement.parse('setuptools')).version)
... ''' % ('\n'.join(
... '%s = %s' % (d.key, d.version)
... for d in zc.buildout.easy_install.buildout_and_setuptools_dists)))
>>> print_(system(buildout), end='')
Installing foo.
...
...
@@ -2867,7 +2874,7 @@ def want_new_zcrecipeegg():
... eggs = demo
... ''')
>>> print_(system(join('bin', 'buildout')), end='') # doctest: +ELLIPSIS
Getting distribution for 'zc.recipe.egg<2dev,>=2.0.0a3'.
Getting distribution for 'zc.recipe.egg<2dev,>=2.0.0a3'.
..
While:
Installing.
Getting section egg.
...
...
@@ -2932,6 +2939,7 @@ def bootstrap_honors_relative_paths():
<BLANKLINE>
import sys
sys.path[0:0] = [
...
join(base, 'eggs/setuptools-0.7-py2.7.egg'),
...
]
...
...
@@ -3273,9 +3281,7 @@ def getWorkingSetWithBuildoutEgg(test):
os
.
path
.
join
(
os
.
path
.
dirname
(
dist
.
location
),
'setup.py'
),
'-q'
,
'bdist_egg'
,
'-d'
,
eggs
],
env
=
dict
(
os
.
environ
,
PYTHONPATH
=
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)
).
location
,
PYTHONPATH
=
zc
.
buildout
.
easy_install
.
setuptools_pythonpath
,
),
)
os
.
chdir
(
here
)
...
...
@@ -3297,10 +3303,9 @@ def updateSetup(test):
test
.
globs
[
'new_releases'
]
=
new_releases
ws
=
getWorkingSetWithBuildoutEgg
(
test
)
# now let's make the new releases
makeNewRelease
(
'zc.buildout'
,
ws
,
new_releases
)
os
.
mkdir
(
os
.
path
.
join
(
new_releases
,
'zc.buildout'
))
makeNewRelease
(
'setuptools'
,
ws
,
new_releases
)
os
.
mkdir
(
os
.
path
.
join
(
new_releases
,
'setuptools'
))
for
dist
in
zc
.
buildout
.
easy_install
.
buildout_and_setuptools_dists
:
makeNewRelease
(
dist
.
key
,
ws
,
new_releases
)
os
.
mkdir
(
os
.
path
.
join
(
new_releases
,
dist
.
key
))
bootstrap_py
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
...
...
@@ -3336,6 +3341,7 @@ def test_suite():
'configparser.test'
),
manuel
.
testing
.
TestSuite
(
manuel
.
doctest
.
Manuel
(
optionflags
=
doctest
.
NORMALIZE_WHITESPACE
|
doctest
.
ELLIPSIS
,
checker
=
renormalizing
.
RENormalizing
([
zc
.
buildout
.
testing
.
normalize_path
,
zc
.
buildout
.
testing
.
normalize_endings
,
...
...
@@ -3378,6 +3384,7 @@ def test_suite():
'
runsetup
.
txt
', '
repeatable
.
txt
', '
setup
.
txt
',
setUp=zc.buildout.testing.buildoutSetUp,
tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings,
...
...
@@ -3434,6 +3441,7 @@ def test_suite():
'
update
.
txt
',
setUp=updateSetup,
tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
(re.compile(r'
(
zc
.
buildout
|
setuptools
)
-
\
d
+
[.]
\
d
+
\
S
*
'
'
-
py
\
d
.
\
d
.
egg
'),
...
...
@@ -3463,6 +3471,7 @@ def test_suite():
'
allowhosts
.
txt
',
setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_script,
zc.buildout.testing.normalize_path,
...
...
src/zc/buildout/update.txt
View file @
6f9fb57a
...
...
@@ -7,8 +7,10 @@ demonstrate this, we've created some "new releases" of buildout and
setuptools in a new_releases folder:
>>> ls(new_releases)
d...
d setuptools
- setuptools-99.99-py2.4.egg
...
d zc.buildout
- zc.buildout-99.99-py2.4.egg
...
...
@@ -70,6 +72,7 @@ new versions found in new releases:
Got zc.buildout 99.99.
Getting distribution for 'setuptools'.
Got setuptools 99.99.
...
Upgraded:
zc.buildout version 99.99,
setuptools version 99.99;
...
...
@@ -89,6 +92,7 @@ Our buildout script has been updated to use the new eggs:
sys.path[0:0] = [
'/sample-buildout/eggs/zc.buildout-99.99-py2.4.egg',
'/sample-buildout/eggs/setuptools-99.99-py2.4.egg',
...
]
<BLANKLINE>
import zc.buildout.buildout
...
...
@@ -228,6 +232,7 @@ directory:
sys.path[0:0] = [
join(base, 'eggs/zc.buildout-99.99-py3.3.egg'),
join(base, 'eggs/setuptools-99.99-py3.3.egg'),
...
]
<BLANKLINE>
import zc.buildout.buildout
...
...
zc.recipe.egg_/src/zc/recipe/egg/README.rst
View file @
6f9fb57a
...
...
@@ -72,9 +72,12 @@ Let's run the buildout:
Now
,
if
we
look
at
the
buildout
eggs
directory:
>
>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg
d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.3.egg
...
d zc.buildout-1.0-py2.3.egg
We see that we got an egg for demo that met the requirement, as well
...
...
@@ -261,9 +264,12 @@ We'll also run the buildout in off-line mode:
We didn't get an update for demo:
>>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg
d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.3.egg
...
d zc.buildout-1.0-py2.3.egg
If we run the buildout on the default online and newest modes,
...
...
@@ -278,10 +284,13 @@ we'll get an update for demo:
Then we'll get a new demo egg:
>>> ls(sample_buildout, 'eggs')
d...
d demo-0.2-py2.3.egg
d demo-0.3-py2.3.egg
d demoneeded-1.1-py2.3.egg
...
- setuptools-0.7-py2.4.egg
...
d zc.buildout-1.0-py2.4.egg
The script is updated too:
...
...
zc.recipe.egg_/src/zc/recipe/egg/api.rst
View file @
6f9fb57a
...
...
@@ -104,10 +104,7 @@ computed by the egg recipe by looking at .installed.cfg:
<BLANKLINE>
[sample-part]
__buildout_installed__ =
__buildout_signature__ = sample-6aWMvV2EJ9Ijq+bR8ugArQ==
zc.recipe.egg-cAsnudgkduAa/Fd+WJIM6Q==
setuptools-0.7-py2.4.egg
zc.buildout-+rYeCcmFuD1K/aB77XTj5A==
__buildout_signature__ = ...
_b = /sample-buildout/bin
_d = /sample-buildout/develop-eggs
_e = /sample-buildout/eggs
...
...
zc.recipe.egg_/src/zc/recipe/egg/custom.rst
View file @
6f9fb57a
...
...
@@ -192,7 +192,7 @@ Let's define a script that uses out ext demo:
Develop
:
'/sample-buildout/demo'
Updating
extdemo
.
Installing
demo
.
Generated
script
'/sample-buildout/bin/demo'
.
Generated
script
'/sample-buildout/bin/demo'
.
..
When
we
run
the
script
,
we
'll 42 printed:
...
...
zc.recipe.egg_/src/zc/recipe/egg/tests.py
View file @
6f9fb57a
...
...
@@ -41,6 +41,7 @@ def test_suite():
doctest
.
DocFileSuite
(
'README.rst'
,
setUp
=
setUp
,
tearDown
=
zc
.
buildout
.
testing
.
buildoutTearDown
,
optionflags
=
doctest
.
NORMALIZE_WHITESPACE
|
doctest
.
ELLIPSIS
,
checker
=
renormalizing
.
RENormalizing
([
zc
.
buildout
.
testing
.
normalize_path
,
zc
.
buildout
.
testing
.
normalize_endings
,
...
...
@@ -59,6 +60,7 @@ def test_suite():
doctest
.
DocFileSuite
(
'api.rst'
,
setUp
=
setUp
,
tearDown
=
zc
.
buildout
.
testing
.
buildoutTearDown
,
optionflags
=
doctest
.
NORMALIZE_WHITESPACE
|
doctest
.
ELLIPSIS
,
checker
=
renormalizing
.
RENormalizing
([
zc
.
buildout
.
testing
.
normalize_path
,
zc
.
buildout
.
testing
.
normalize_endings
,
...
...
@@ -79,6 +81,7 @@ def test_suite():
doctest.DocFileSuite(
'
custom
.
rst
',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings,
...
...
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