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
8564e325
Commit
8564e325
authored
Jan 13, 2013
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed: initialization code wasn't included in interpeter scripts.
parent
0ea7257d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
6 deletions
+56
-6
CHANGES.rst
CHANGES.rst
+3
-1
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+7
-3
src/zc/buildout/easy_install.txt
src/zc/buildout/easy_install.txt
+22
-2
zc.recipe.egg_/src/zc/recipe/egg/README.txt
zc.recipe.egg_/src/zc/recipe/egg/README.txt
+24
-0
No files found.
CHANGES.rst
View file @
8564e325
...
...
@@ -4,7 +4,9 @@ Change History
2.0.0b1 (2013-01-??)
====================
Fixed: Macro inheritance bug, https://github.com/buildout/buildout/pull/37
Fixed: initialization code wasn't included in interpeter scripts.
Fixed: macro inheritance bug, https://github.com/buildout/buildout/pull/37
2.0.0a7 (2013-01-12)
====================
...
...
src/zc/buildout/easy_install.py
View file @
8564e325
...
...
@@ -922,7 +922,7 @@ def scripts(reqs, working_set, executable, dest=None,
if
interpreter
:
sname
=
os
.
path
.
join
(
dest
,
interpreter
)
spath
,
rpsetup
=
_relative_path_and_setup
(
sname
,
path
,
relative_paths
)
generated
.
extend
(
_pyscript
(
spath
,
sname
,
rpsetup
))
generated
.
extend
(
_pyscript
(
spath
,
sname
,
rpsetup
,
initialization
))
return
generated
...
...
@@ -1043,7 +1043,9 @@ def _create_script(contents, dest):
win32_exe
=
win32_exe
[:
-
7
]
# remove "-script"
win32_exe
=
win32_exe
+
'.exe'
# add ".exe"
new_data
=
pkg_resources
.
resource_string
(
'setuptools'
,
'cli.exe'
)
if
not
os
.
path
.
exists
(
win32_exe
)
or
(
open
(
win32_exe
,
'rb'
).
read
()
!=
new_data
):
if
(
not
os
.
path
.
exists
(
win32_exe
)
or
(
open
(
win32_exe
,
'rb'
).
read
()
!=
new_data
)
):
# Only write it if it's different.
open
(
win32_exe
,
'wb'
).
write
(
new_data
)
generated
.
append
(
win32_exe
)
...
...
@@ -1096,7 +1098,7 @@ sys.path[0:0] = [
%(original_content)s'''
def
_pyscript
(
path
,
dest
,
rsetup
):
def
_pyscript
(
path
,
dest
,
rsetup
,
initialization
=
''
):
generated
=
[]
script
=
dest
if
is_win32
:
...
...
@@ -1108,6 +1110,7 @@ def _pyscript(path, dest, rsetup):
python
=
python
,
path
=
path
,
relative_paths_setup
=
rsetup
,
initialization
=
initialization
,
)
changed
=
not
(
os
.
path
.
exists
(
dest
)
and
open
(
dest
).
read
()
==
contents
)
...
...
@@ -1138,6 +1141,7 @@ import sys
sys.path[0:0] = [
%(path)s,
]
%(initialization)s
_interactive = True
if len(sys.argv) > 1:
...
...
src/zc/buildout/easy_install.txt
View file @
8564e325
...
...
@@ -755,7 +755,8 @@ You can also pass script initialization code:
>>> scripts = zc.buildout.easy_install.scripts(
... ['demo'], ws, sys.executable, bin, dict(demo='run'),
... arguments='1, 2',
... initialization='import os\nos.chdir("foo")')
... initialization='import os\nos.chdir("foo")',
... interpreter='py')
>>> cat(bin, 'run') # doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.7
...
...
@@ -773,6 +774,25 @@ You can also pass script initialization code:
if __name__ == '__main__':
sys.exit(eggrecipedemo.main(1, 2))
It will be included in interpreters too:
>>> cat(bin, 'py') # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
#!/Users/jim/bin/python3.3
<BLANKLINE>
import sys
<BLANKLINE>
sys.path[0:0] = [
'/sample-install/demo-0.3-py3.3.egg',
'/sample-install/demoneeded-1.1-py3.3.egg',
]
<BLANKLINE>
import os
os.chdir("foo")
<BLANKLINE>
<BLANKLINE>
_interactive = True
...
Relative paths
--------------
...
...
@@ -829,7 +849,7 @@ Of course, running the script works:
We specified an interpreter and its paths are adjusted too:
>>> cat(bo, 'bin', 'py')
>>> cat(bo, 'bin', 'py')
# doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.7
<BLANKLINE>
import os
...
...
zc.recipe.egg_/src/zc/recipe/egg/README.txt
View file @
8564e325
...
...
@@ -506,6 +506,7 @@ to be included in generated scripts:
... ${buildout:directory}/spam
... initialization = a = (1, 2
... 3, 4)
... interpreter = py
... arguments = a, 2
... """ % dict(server=link_server))
...
...
@@ -513,6 +514,7 @@ to be included in generated scripts:
Uninstalling demo.
Installing demo.
Generated script '/sample-buildout/bin/foo'.
Generated interpreter '/sample-buildout/bin/py'.
>>> cat(sample_buildout, 'bin', 'foo') # doctest: +NORMALIZE_WHITESPACE
#!/usr/local/bin/python2.7
...
...
@@ -538,6 +540,28 @@ setting the path. Note, as mentioned above, that leading whitespace
has been stripped. Similarly, the argument code we specified was
added in the entry point call (to main).
Our interpreter also has the initialization code:
>>> cat(sample_buildout, 'bin', 'py')
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
#!/usr/local/bin/python2.7
<BLANKLINE>
import sys
<BLANKLINE>
sys.path[0:0] = [
'/sample-buildout/eggs/demo-0.3-py3.3.egg',
'/sample-buildout/eggs/demoneeded-1.1-py3.3.egg',
'/foo/bar',
'/sample-buildout/spam',
]
<BLANKLINE>
a = (1, 2
3, 4)
<BLANKLINE>
<BLANKLINE>
_interactive = True
...
Specifying entry points
-----------------------
...
...
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