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
Yusei Tahara
slapos.buildout
Commits
c0842786
Commit
c0842786
authored
Mar 18, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored generation of relative egg paths to generate simpler code.
parent
8ffcf2a1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
47 deletions
+34
-47
CHANGES.txt
CHANGES.txt
+5
-0
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+4
-10
src/zc/buildout/easy_install.txt
src/zc/buildout/easy_install.txt
+10
-19
zc.recipe.egg_/CHANGES.txt
zc.recipe.egg_/CHANGES.txt
+5
-0
zc.recipe.egg_/src/zc/recipe/egg/README.txt
zc.recipe.egg_/src/zc/recipe/egg/README.txt
+10
-18
No files found.
CHANGES.txt
View file @
c0842786
...
...
@@ -4,6 +4,11 @@ Status
Change History
**************
1.2.1 (2009-03-18)
==================
- Refactored generation of relative egg paths to generate simpler code.
1.2.0 (2009-03-17)
==================
...
...
src/zc/buildout/easy_install.py
View file @
c0842786
...
...
@@ -973,6 +973,8 @@ def _relative_path_and_setup(sname, path, relative_paths):
for
path_item
in
path
]
)
rpsetup
=
relative_paths_setup
for
i
in
range
(
_relative_depth
(
relative_paths
,
sname
)):
rpsetup
+=
"base = os.path.dirname(base)
\
n
"
else
:
spath
=
repr
(
path
)[
1
:
-
1
].
replace
(
', '
,
',
\
n
'
)
rpsetup
=
''
...
...
@@ -1011,9 +1013,7 @@ def _relativitize(path, script, relative_paths):
if
(
common
==
relative_paths
or
common
.
startswith
(
os
.
path
.
join
(
relative_paths
,
''
))
):
return
"join(dirname(%s, __file__), %r)"
%
(
_relative_depth
(
common
,
script
),
_relative_path
(
common
,
path
)
)
return
"join(base, %r)"
%
_relative_path
(
common
,
path
)
else
:
return
repr
(
path
)
...
...
@@ -1021,13 +1021,8 @@ def _relativitize(path, script, relative_paths):
relative_paths_setup
=
"""
import os
def dirname(n, path):
while n >= 0:
n -= 1
path = os.path.dirname(path)
return path
join = os.path.join
base = os.path.dirname(__file__)
"""
def
_script
(
module_name
,
attrs
,
path
,
dest
,
executable
,
arguments
,
...
...
@@ -1124,7 +1119,6 @@ def _pyscript(path, dest, executable, rsetup):
py_script_template
=
script_header
+
'''
\
%(relative_paths_setup)s
import sys
...
...
src/zc/buildout/easy_install.txt
View file @
c0842786
...
...
@@ -814,20 +814,16 @@ to pass a common base directory of the scripts and eggs:
<BLANKLINE>
import os
<BLANKLINE>
def dirname(n, path):
while n >= 0:
n -= 1
path = os.path.dirname(path)
return path
<BLANKLINE>
join = os.path.join
base = os.path.dirname(__file__)
base = os.path.dirname(base)
<BLANKLINE>
import sys
sys.path[0:0] = [
join(
dirname(1, __file__), 'eggs/demo-0.3-py2.4
.egg'),
join(
dirname(1, __file__), 'eggs/demoneeded-1.1-py2.4
.egg'),
join(
base, 'eggs/demo-0.3-pyN.N
.egg'),
join(
base, 'eggs/demoneeded-1.1-pyN.N
.egg'),
'/foo',
join(
dirname(1, __file__)
, 'bar'),
join(
base
, 'bar'),
]
<BLANKLINE>
import eggrecipedemo
...
...
@@ -848,24 +844,19 @@ We specified an interpreter and its paths are adjusted too:
>>> cat(bo, 'bin', 'py')
#!/usr/local/bin/python2.4
<BLANKLINE>
<BLANKLINE>
import os
<BLANKLINE>
def dirname(n, path):
while n >= 0:
n -= 1
path = os.path.dirname(path)
return path
<BLANKLINE>
join = os.path.join
base = os.path.dirname(__file__)
base = os.path.dirname(base)
<BLANKLINE>
import sys
<BLANKLINE>
sys.path[0:0] = [
join(
dirname(1, __file__), 'eggs/demo-0.3-py2.4
.egg'),
join(
dirname(1, __file__), 'eggs/demoneeded-1.1-py2.4
.egg'),
join(
base, 'eggs/demo-0.3-pyN.N
.egg'),
join(
base, 'eggs/demoneeded-1.1-pyN.N
.egg'),
'/foo',
join(
dirname(1, __file__)
, 'bar'),
join(
base
, 'bar'),
]
<BLANKLINE>
_interactive = True
...
...
zc.recipe.egg_/CHANGES.txt
View file @
c0842786
Change History
**************
1.2.1 (2009-03-18)
==================
- Refactored generation of relative egg paths to generate simpler code.
1.2.0 (2009-03-17)
==================
...
...
zc.recipe.egg_/src/zc/recipe/egg/README.txt
View file @
c0842786
...
...
@@ -424,20 +424,16 @@ Let's look at the script that was generated:
<BLANKLINE>
import os
<BLANKLINE>
def dirname(n, path):
while n >= 0:
n -= 1
path = os.path.dirname(path)
return path
<BLANKLINE>
join = os.path.join
base = os.path.dirname(__file__)
base = os.path.dirname(base)
<BLANKLINE>
import sys
sys.path[0:0] = [
join(
dirname(1, __file__), 'eggs/demo-0.4c1-py2.4
.egg'),
join(
dirname(1, __file__), 'eggs/demoneeded-1.2c1-py2.4
.egg'),
join(
base, 'eggs/demo-0.4c1-pyN.N
.egg'),
join(
base, 'eggs/demoneeded-1.2c1-pyN.N
.egg'),
'/foo/bar',
join(
dirname(1, __file__)
, 'spam'),
join(
base
, 'spam'),
]
<BLANKLINE>
import eggrecipedemo
...
...
@@ -475,20 +471,16 @@ each individual script section:
<BLANKLINE>
import os
<BLANKLINE>
def dirname(n, path):
while n >= 0:
n -= 1
path = os.path.dirname(path)
return path
<BLANKLINE>
join = os.path.join
base = os.path.dirname(__file__)
base = os.path.dirname(base)
<BLANKLINE>
import sys
sys.path[0:0] = [
join(
dirname(1, __file__), 'eggs/demo-0.4c1-py2.4
.egg'),
join(
dirname(1, __file__), 'eggs/demoneeded-1.2c1-py2.4
.egg'),
join(
base, 'eggs/demo-0.4c1-pyN.N
.egg'),
join(
base, 'eggs/demoneeded-1.2c1-pyN.N
.egg'),
'/foo/bar',
join(
dirname(1, __file__)
, 'spam'),
join(
base
, 'spam'),
]
<BLANKLINE>
import eggrecipedemo
...
...
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