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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos.buildout
Commits
57787791
Commit
57787791
authored
Aug 23, 2010
by
Gary Poster
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support dicts passed as options to zc.recipe.egg, with a test.
parent
c6da22cc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
7 deletions
+77
-7
zc.recipe.egg_/CHANGES.txt
zc.recipe.egg_/CHANGES.txt
+3
-2
zc.recipe.egg_/setup.py
zc.recipe.egg_/setup.py
+1
-1
zc.recipe.egg_/src/zc/recipe/egg/api.txt
zc.recipe.egg_/src/zc/recipe/egg/api.txt
+0
-2
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+36
-1
zc.recipe.egg_/src/zc/recipe/egg/tests.py
zc.recipe.egg_/src/zc/recipe/egg/tests.py
+37
-1
No files found.
zc.recipe.egg_/CHANGES.txt
View file @
57787791
Change History
Change History
**************
**************
1.3.1 (
unreleased
)
1.3.1 (
2010-08-23
)
==================
==================
(no changes so far)
- Support recipes that are using zc.recipe.egg by passing in a dict, rather
than a zc.buildout.buildout.Options object as was expected/tested.
1.3.0 (2010-08-23)
1.3.0 (2010-08-23)
==================
==================
...
...
zc.recipe.egg_/setup.py
View file @
57787791
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
"""Setup for zc.recipe.egg package
"""Setup for zc.recipe.egg package
"""
"""
version
=
'1.3.1
dev
'
version
=
'1.3.1'
import
os
import
os
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
...
...
zc.recipe.egg_/src/zc/recipe/egg/api.txt
View file @
57787791
...
@@ -122,7 +122,6 @@ computed by the egg recipe by looking at .installed.cfg:
...
@@ -122,7 +122,6 @@ computed by the egg recipe by looking at .installed.cfg:
If we use the extra-paths option:
If we use the extra-paths option:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... """
... """
... [buildout]
... [buildout]
...
@@ -151,4 +150,3 @@ recipe instance:
...
@@ -151,4 +150,3 @@ recipe instance:
other 1.0
other 1.0
demoneeded 1.2c1
demoneeded 1.2c1
extra paths: ['/foo/bar', '/spam/eggs']
extra paths: ['/foo/bar', '/spam/eggs']
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
57787791
...
@@ -16,7 +16,8 @@
...
@@ -16,7 +16,8 @@
$Id$
$Id$
"""
"""
import
logging
,
os
,
re
,
zipfile
import
UserDict
,
logging
,
os
,
re
,
zipfile
import
zc.buildout
import
zc.buildout.easy_install
import
zc.buildout.easy_install
...
@@ -27,6 +28,11 @@ class Eggs(object):
...
@@ -27,6 +28,11 @@ class Eggs(object):
def
__init__
(
self
,
buildout
,
name
,
options
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
buildout
=
buildout
self
.
buildout
=
buildout
self
.
name
=
self
.
default_eggs
=
name
self
.
name
=
self
.
default_eggs
=
name
if
getattr
(
options
,
'query_bool'
,
None
)
is
None
:
# Someone is not passing us a zc.buildout.buildout.Options
# object. Maybe we should have a deprecation warning.
# Whatever.
options
=
_BackwardsSupportOption
(
options
)
self
.
options
=
options
self
.
options
=
options
b_options
=
buildout
[
'buildout'
]
b_options
=
buildout
[
'buildout'
]
links
=
options
.
get
(
'find-links'
,
b_options
[
'find-links'
])
links
=
options
.
get
(
'find-links'
,
b_options
[
'find-links'
])
...
@@ -190,3 +196,32 @@ class Scripts(ScriptBase):
...
@@ -190,3 +196,32 @@ class Scripts(ScriptBase):
)
)
Egg
=
Scripts
Egg
=
Scripts
class
_BackwardsSupportOption
(
UserDict
.
UserDict
):
def
query_bool
(
self
,
name
,
default
=
None
):
"""Given a name, return a boolean value for that name.
``default``, if given, should be 'true', 'false', or None.
"""
if
default
is
not
None
:
value
=
self
.
setdefault
(
name
,
default
)
else
:
value
=
self
.
get
(
name
)
if
value
is
None
:
return
value
return
_convert_bool
(
name
,
value
)
def
get_bool
(
self
,
name
):
"""Given a name, return a boolean value for that name.
"""
return
_convert_bool
(
name
,
self
[
name
])
def
_convert_bool
(
name
,
value
):
if
value
not
in
(
'true'
,
'false'
):
raise
zc
.
buildout
.
UserError
(
'Invalid value for %s option: %s'
%
(
name
,
value
))
else
:
return
value
==
'true'
zc.recipe.egg_/src/zc/recipe/egg/tests.py
View file @
57787791
...
@@ -29,6 +29,40 @@ def dirname(d, level=1):
...
@@ -29,6 +29,40 @@ def dirname(d, level=1):
return
d
return
d
return
dirname
(
os
.
path
.
dirname
(
d
),
level
-
1
)
return
dirname
(
os
.
path
.
dirname
(
d
),
level
-
1
)
def
testUsingDictAsOptions
():
"""
Some recipes using zc.recipe.egg have been passing dictionaries rather than
zc.buildout.buildout.Options objects. That's unexpected, but to save
complaints, we'll support it.
Note that this test intends to show that a dictionary can be used as an
options object. It also uses a dictionary for the buildout object, which is
not intended.
>>> import zc.buildout.buildout
>>> import zc.recipe.egg
>>> faux_egg_options = {
... 'find-links': 'example.com',
... 'bin-directory': '/somewhere/over/rainbow'}
>>> faux_buildout_options = zc.buildout.buildout._unannotate_section(
... zc.buildout.buildout._buildout_default_options.copy())
>>> faux_buildout = {
... 'faux': faux_egg_options, 'buildout': faux_buildout_options}
>>> scripts = zc.recipe.egg.Scripts(
... faux_buildout, 'faux', faux_egg_options)
>>> scripts.links
['example.com']
>>> import zc.buildout.easy_install
>>> old_install = zc.buildout.easy_install.install
>>> old_scripts = zc.buildout.easy_install.scripts
>>> def whatever(*args, **kwargs): pass
>>> zc.buildout.easy_install.install = whatever
>>> zc.buildout.easy_install.scripts = whatever
>>> scripts.install() # This used to fail!
>>> zc.buildout.easy_install.install = old_install
>>> zc.buildout.easy_install.scripts = old_scripts
"""
def
setUp
(
test
):
def
setUp
(
test
):
zc
.
buildout
.
tests
.
easy_install_SetUp
(
test
)
zc
.
buildout
.
tests
.
easy_install_SetUp
(
test
)
zc
.
buildout
.
testing
.
install_develop
(
'zc.recipe.egg'
,
test
)
zc
.
buildout
.
testing
.
install_develop
(
'zc.recipe.egg'
,
test
)
...
@@ -96,7 +130,9 @@ def test_suite():
...
@@ -96,7 +130,9 @@ def test_suite():
(re.compile('
extdemo
[.]
pyd
'), '
extdemo
.
so
')
(re.compile('
extdemo
[.]
pyd
'), '
extdemo
.
so
')
]),
]),
),
),
doctest.DocTestSuite(
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
),
))
))
if sys.version_info[:2] != (2, 4):
if sys.version_info[:2] != (2, 4):
...
...
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