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
isaak yansane-sisk
slapos.buildout
Commits
4f679e8d
Commit
4f679e8d
authored
Jun 10, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Plain Diff
Merge zc.recipe.egg branch
Conflicts: zc.recipe.egg_/setup.py zc.recipe.egg_/src/zc/recipe/egg/egg.py
parents
792deebc
7af0dfd0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
39 deletions
+135
-39
zc.recipe.egg_/CHANGES.SlapOS.txt
zc.recipe.egg_/CHANGES.SlapOS.txt
+25
-0
zc.recipe.egg_/src/zc/recipe/egg/custom.py
zc.recipe.egg_/src/zc/recipe/egg/custom.py
+80
-39
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+30
-0
No files found.
zc.recipe.egg_/CHANGES.SlapOS.txt
0 → 100644
View file @
4f679e8d
1.3.2.post4
-----------
- Fix a regression in 1.3.2.post3 that breaks setup-eggs option.
1.3.2.post3
-----------
- Support environment in zc.recipe.egg:develop.
1.3.2.post2
-----------
- Version string is now N.N.N.devN to follow http://legacy.python.org/dev/peps/pep-0440/ .
- Support on the fly patches in zc.recipe.egg by ``EGGNAME-patches``,
``EGGNAME-patch-options``, ``EGGNAME-patch-binary`` (or
``patch-binary``) and ``EGGNAME-patch-revision`` options.
- Support on the fly patches in zc.recipe.egg:custom by ``patches``,
``patch-options``, ``patch-binary`` and ``patch-revision`` options.
(options ``EGGNAME-*`` are also supported as well).
1.3.2nxd001
-----------
- Add setup-eggs option in zc.recipe.egg:custom.
zc.recipe.egg_/src/zc/recipe/egg/custom.py
View file @
4f679e8d
...
...
@@ -32,11 +32,69 @@ class Base:
python
=
options
.
get
(
'python'
,
buildout
[
'buildout'
][
'python'
])
options
[
'executable'
]
=
buildout
[
python
][
'executable'
]
environment_section
=
options
.
get
(
'environment'
)
if
environment_section
:
self
.
environment
=
buildout
[
environment_section
]
else
:
self
.
environment
=
{}
environment_data
=
self
.
environment
.
items
()
environment_data
.
sort
()
options
[
'_environment-data'
]
=
repr
(
environment_data
)
self
.
build_ext
=
build_ext
(
buildout
,
options
)
def
install
(
self
):
self
.
_set_environment
()
try
:
return
self
.
_install
()
finally
:
self
.
_restore_environment
()
def
update
(
self
):
return
self
.
install
()
def
_set_environment
(
self
):
self
.
_saved_environment
=
{}
for
key
,
value
in
self
.
environment
.
items
():
if
key
in
os
.
environ
:
self
.
_saved_environment
[
key
]
=
os
.
environ
[
key
]
# Interpolate value with variables from environment. Maybe there
# should be a general way of doing this in buildout with something
# like ${environ:foo}:
os
.
environ
[
key
]
=
value
%
os
.
environ
def
_restore_environment
(
self
):
for
key
in
self
.
environment
:
if
key
in
self
.
_saved_environment
:
os
.
environ
[
key
]
=
self
.
_saved_environment
[
key
]
else
:
try
:
del
os
.
environ
[
key
]
except
KeyError
:
pass
def
_get_patch_dict
(
self
,
options
,
distribution
):
patch_dict
=
{}
global_patch_binary
=
options
.
get
(
'patch-binary'
,
'patch'
)
def
get_option
(
egg
,
key
,
default
):
return
options
.
get
(
'%s-%s'
%
(
egg
,
key
),
options
.
get
(
key
,
default
))
egg
=
re
.
sub
(
'[<>=].*'
,
''
,
distribution
)
patches
=
filter
(
lambda
x
:
x
,
map
(
lambda
x
:
x
.
strip
(),
get_option
(
egg
,
'patches'
,
''
).
splitlines
()))
if
not
patches
:
return
patch_dict
patch_options
=
get_option
(
egg
,
'patch-options'
,
'-p0'
).
split
()
patch_binary
=
get_option
(
egg
,
'patch-binary'
,
global_patch_binary
)
patch_revision
=
int
(
get_option
(
egg
,
'patch-revision'
,
len
(
patches
)))
patch_dict
[
egg
]
=
{
'patches'
:
patches
,
'patch_options'
:
patch_options
,
'patch_binary'
:
patch_binary
,
'patch_revision'
:
patch_revision
,
}
return
patch_dict
class
Custom
(
Base
):
...
...
@@ -57,25 +115,16 @@ class Custom(Base):
options
[
'index'
]
=
index
self
.
index
=
index
environment_section
=
options
.
get
(
'environment'
)
if
environment_section
:
self
.
environment
=
buildout
[
environment_section
]
else
:
self
.
environment
=
{}
environment_data
=
self
.
environment
.
items
()
environment_data
.
sort
()
options
[
'_environment-data'
]
=
repr
(
environment_data
)
options
[
'_e'
]
=
buildout
[
'buildout'
][
'eggs-directory'
]
assert
options
.
get
(
'unzip'
)
in
(
'true'
,
'false'
,
None
)
if
buildout
[
'buildout'
].
get
(
'offline'
)
==
'true'
:
self
.
install
=
lambda
:
()
self
.
_
install
=
lambda
:
()
self
.
newest
=
buildout
[
'buildout'
].
get
(
'newest'
)
==
'true'
def
install
(
self
):
def
_
install
(
self
):
options
=
self
.
options
distribution
=
options
.
get
(
'egg'
)
if
distribution
is
None
:
...
...
@@ -88,36 +137,28 @@ class Custom(Base):
distribution
=
options
.
get
(
'egg'
,
options
.
get
(
'eggs'
,
self
.
name
)
).
strip
()
self
.
_set_environment
()
try
:
return
zc
.
buildout
.
easy_install
.
build
(
distribution
,
options
[
'_d'
],
self
.
build_ext
,
self
.
links
,
self
.
index
,
options
[
'executable'
],
[
options
[
'_e'
]],
setup_eggs
=
[
r
.
strip
()
for
r
in
options
.
get
(
'setup-eggs'
,
''
).
split
(
'
\
n
'
)
if
r
.
strip
()]
if
setup_eggs
:
ws
=
zc
.
buildout
.
easy_install
.
install
(
setup_eggs
,
options
[
'_e'
],
links
=
self
.
links
,
index
=
self
.
index
,
executable
=
options
[
'executable'
],
path
=
[
options
[
'_d'
],
options
[
'_e'
]],
newest
=
self
.
newest
,
)
finally
:
self
.
_restore_environment
()
extra_path
=
os
.
pathsep
.
join
(
ws
.
entries
)
self
.
environment
[
'PYTHONEXTRAPATH'
]
=
os
.
environ
[
'PYTHONEXTRAPATH'
]
=
extra_path
def
_set_environment
(
self
):
self
.
_saved_environment
=
{}
for
key
,
value
in
self
.
environment
.
items
():
if
key
in
os
.
environ
:
self
.
_saved_environment
[
key
]
=
os
.
environ
[
key
]
# Interpolate value with variables from environment. Maybe there
# should be a general way of doing this in buildout with something
# like ${environ:foo}:
os
.
environ
[
key
]
=
value
%
os
.
environ
def
_restore_environment
(
self
):
for
key
in
self
.
environment
:
if
key
in
self
.
_saved_environment
:
os
.
environ
[
key
]
=
self
.
_saved_environment
[
key
]
else
:
try
:
del
os
.
environ
[
key
]
except
KeyError
:
pass
patch_dict
=
self
.
_get_patch_dict
(
options
,
distribution
)
return
zc
.
buildout
.
easy_install
.
build
(
distribution
,
options
[
'_d'
],
self
.
build_ext
,
self
.
links
,
self
.
index
,
options
[
'executable'
],
[
options
[
'_e'
]],
newest
=
self
.
newest
,
patch_dict
=
patch_dict
)
class
Develop
(
Base
):
...
...
@@ -127,7 +168,7 @@ class Develop(Base):
options
[
'setup'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'directory'
],
options
[
'setup'
])
def
install
(
self
):
def
_
install
(
self
):
options
=
self
.
options
return
zc
.
buildout
.
easy_install
.
develop
(
options
[
'setup'
],
options
[
'_d'
],
self
.
build_ext
,
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
4f679e8d
...
...
@@ -61,6 +61,33 @@ class Eggs(object):
python
=
options
.
setdefault
(
'python'
,
b_options
[
'python'
])
options
[
'executable'
]
=
buildout
[
python
][
'executable'
]
def
_get_patch_dict
(
self
,
options
,
distribution_list
):
patch_dict
=
{}
global_patch_binary
=
options
.
get
(
'patch-binary'
,
'patch'
)
def
get_option
(
egg
,
key
,
default
):
if
len
(
distribution_list
)
==
1
:
return
options
.
get
(
'%s-%s'
%
(
egg
,
key
),
options
.
get
(
key
,
default
))
else
:
return
options
.
get
(
'%s-%s'
%
(
egg
,
key
),
default
)
for
distribution
in
distribution_list
:
egg
=
re
.
sub
(
'[<>=].*'
,
''
,
distribution
)
patches
=
filter
(
lambda
x
:
x
,
map
(
lambda
x
:
x
.
strip
(),
get_option
(
egg
,
'patches'
,
''
).
splitlines
()))
if
not
patches
:
continue
patch_options
=
get_option
(
egg
,
'patch-options'
,
'-p0'
).
split
()
patch_binary
=
get_option
(
egg
,
'patch-binary'
,
global_patch_binary
)
patch_revision
=
int
(
get_option
(
egg
,
'patch-revision'
,
len
(
patches
)))
patch_dict
[
egg
]
=
{
'patches'
:
patches
,
'patch_options'
:
patch_options
,
'patch_binary'
:
patch_binary
,
'patch_revision'
:
patch_revision
,
}
return
patch_dict
def
working_set
(
self
,
extra
=
()):
"""Separate method to just get the working set
...
...
@@ -88,6 +115,7 @@ class Eggs(object):
kw
=
{}
if
'unzip'
in
options
:
kw
[
'always_unzip'
]
=
options
.
query_bool
(
'unzip'
,
None
)
for
option_key
,
kw_key
in
(
(
'__networkcache__download-cache-url'
,
'download_cache_url'
),
(
'__networkcache__download-dir-url'
,
'download_dir_url'
),
...
...
@@ -109,6 +137,7 @@ class Eggs(object):
else
:
kw
[
kw_key
]
=
b_options
[
option_key
]
patch_dict
=
self
.
_get_patch_dict
(
options
,
distributions
)
ws
=
zc
.
buildout
.
easy_install
.
install
(
distributions
,
options
[
'eggs-directory'
],
links
=
self
.
links
,
...
...
@@ -119,6 +148,7 @@ class Eggs(object):
include_site_packages
=
self
.
include_site_packages
,
allowed_eggs_from_site_packages
=
self
.
allowed_eggs
,
allow_hosts
=
self
.
allow_hosts
,
patch_dict
=
patch_dict
,
**
kw
)
return
orig_distributions
,
ws
...
...
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