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
3ee1ab2c
Commit
3ee1ab2c
authored
Sep 04, 2009
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
old-style distutils scripts are now also detected in zipped eggs
parent
1ba552fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
11 deletions
+42
-11
doc/tutorial.txt
doc/tutorial.txt
+2
-2
src/zc/buildout/downloadcache.txt
src/zc/buildout/downloadcache.txt
+1
-0
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+15
-6
src/zc/buildout/easy_install.txt
src/zc/buildout/easy_install.txt
+14
-3
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+9
-0
zc.recipe.egg_/src/zc/recipe/egg/README.txt
zc.recipe.egg_/src/zc/recipe/egg/README.txt
+1
-0
No files found.
doc/tutorial.txt
View file @
3ee1ab2c
...
...
@@ -863,8 +863,8 @@ Installing scripts
If a distribution doesn't use setuptools, it may not declare it's entry
points. In that case, you can specify entry points in the recipe data.
Buildout *does* detect distutils-style scripts without an entry point
in
case the egg is unzipped and
will generate a script for them when found.
Buildout *does* detect distutils-style scripts without an entry point
and
will generate a script for them when found.
Script initialization
=====================
...
...
src/zc/buildout/downloadcache.txt
View file @
3ee1ab2c
...
...
@@ -41,6 +41,7 @@ download:
<a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
<a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
<a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
<a href="du_zipped-1.0-pyN.N.egg">du_zipped-1.0-pyN.N.egg</a><br>
<a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
<a href="index/">index/</a><br>
<a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br>
...
...
src/zc/buildout/easy_install.py
View file @
3ee1ab2c
...
...
@@ -33,6 +33,7 @@ import subprocess
import
sys
import
tempfile
import
zc.buildout
import
zipfile
import
zipimport
_oprp
=
getattr
(
os
.
path
,
'realpath'
,
lambda
path
:
path
)
...
...
@@ -939,18 +940,26 @@ def scripts(reqs, working_set, executable, dest,
(
name
,
entry_point
.
module_name
,
'.'
.
join
(
entry_point
.
attrs
))
)
# "old-style" distutils scripts
# The metadata on "old-style" distutils scripts is not retained by
# distutils/setuptools, except by placing the original scripts in
# /EGG-INFO/scripts/.
if
os
.
path
.
isdir
(
dist
.
location
):
# The metadata on scripts is not retained by
# distutils/setuptools, except by placing the original scripts
# in /EGG-INFO/scripts/. os.listdir() is used to detect them.
# Zipped eggs would need unpacking for this to work, which is
# too resource intensive, so zipped eggs are not supported.
# Unzipped egg: use os.listdir() to detect possible scripts.
scripts_dir
=
os
.
path
.
join
(
dist
.
location
,
'EGG-INFO'
,
'scripts'
)
if
os
.
path
.
exists
(
scripts_dir
):
for
name
in
os
.
listdir
(
scripts_dir
):
distutils_scripts
.
append
(
(
name
,
os
.
path
.
join
(
scripts_dir
,
name
)))
else
:
# Zipped egg: use zipfile to detect possible scripts.
zipped
=
zipfile
.
ZipFile
(
dist
.
location
)
for
filepath
in
zipped
.
namelist
():
if
filepath
.
startswith
(
'EGG-INFO/scripts'
):
name
=
os
.
path
.
basename
(
filepath
)
fd
,
tmp_script
=
tempfile
.
mkstemp
()
os
.
write
(
fd
,
zipped
.
read
(
filepath
))
os
.
close
(
fd
)
distutils_scripts
.
append
((
name
,
tmp_script
))
else
:
entry_points
.
append
(
req
)
...
...
src/zc/buildout/easy_install.txt
View file @
3ee1ab2c
...
...
@@ -109,6 +109,7 @@ We have a link server that has a number of eggs:
<a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
<a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
<a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
<a href="du_zipped-1.0-pyN.N.egg">du_zipped-1.0-pyN.N.egg</a><br>
<a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
<a href="index/">index/</a><br>
<a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br>
...
...
@@ -929,6 +930,18 @@ Buildout also installs those:
>>> ls(distbin)
- distutilsscript
It also works for zipped eggs:
>>> distdir2 = tmpdir('distutilsscriptdir2')
>>> distbin2 = tmpdir('distutilsscriptbin2')
>>> ws = zc.buildout.easy_install.install(
... ['du_zipped'], distdir2,
... links=[link_server], index=link_server+'index/')
>>> scripts = zc.buildout.easy_install.scripts(
... ['du_zipped'], ws, sys.executable, distbin2)
>>> ls(distbin2)
- distutilsscript
Distutils copies the script files verbatim, apart from a line at the top that
looks like ``#!/usr/bin/python``, which gets replaced by the actual python
interpreter. Buildout does the same, but additionally also adds the sys.path
...
...
@@ -948,9 +961,6 @@ like for the console_scripts:
Due to the nature of distutils scripts, buildout cannot pass arguments as
there's no specific method to pass them to.
A second restriction is that scripts are only detected if the eggs are
unzipped. Unzipping all zipped eggs for detecting old-style distutils scripts
is a bit wasteful.
Handling custom build options for extensions provided in source distributions
-----------------------------------------------------------------------------
...
...
@@ -1075,6 +1085,7 @@ Let's update our link server with a new version of extdemo:
<a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
<a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
<a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
<a href="du_zipped-1.0-pyN.N.egg">du_zipped-1.0-pyN.N.egg</a><br>
<a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
<a href="extdemo-1.5.zip">extdemo-1.5.zip</a><br>
<a href="index/">index/</a><br>
...
...
src/zc/buildout/tests.py
View file @
3ee1ab2c
...
...
@@ -2685,6 +2685,15 @@ def create_sample_eggs(test, executable=sys.executable):
)
zc
.
buildout
.
testing
.
bdist_egg
(
tmp
,
executable
,
dest
)
write
(
tmp
,
'setup.py'
,
"from setuptools import setup
\
n
"
"setup(name='du_zipped', zip_safe=True, version='1.0', "
"scripts=['distutilsscript'],"
"py_modules=['eggrecipedemoneeded'])
\
n
"
)
zc
.
buildout
.
testing
.
bdist_egg
(
tmp
,
executable
,
dest
)
os
.
remove
(
os
.
path
.
join
(
tmp
,
'distutilsscript'
))
os
.
remove
(
os
.
path
.
join
(
tmp
,
'eggrecipedemoneeded.py'
))
...
...
zc.recipe.egg_/src/zc/recipe/egg/README.txt
View file @
3ee1ab2c
...
...
@@ -41,6 +41,7 @@ We have a link server that has a number of distributions:
<a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
<a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
<a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
<a href="du_zipped-1.0-pyN.N.egg">du_zipped-1.0-pyN.N.egg</a><br>
<a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
<a href="index/">index/</a><br>
<a href="other-1.0-py2.3.egg">other-1.0-py2.3.egg</a><br>
...
...
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