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
e87c4bdf
Commit
e87c4bdf
authored
Sep 15, 2006
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a runsetup command, to make egg generation a little easier.
parent
588cd2cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
3 deletions
+88
-3
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+39
-2
src/zc/buildout/runsetup.txt
src/zc/buildout/runsetup.txt
+46
-0
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+3
-1
No files found.
src/zc/buildout/buildout.py
View file @
e87c4bdf
...
...
@@ -23,6 +23,7 @@ import pprint
import
re
import
shutil
import
sys
import
tempfile
import
ConfigParser
import
pkg_resources
...
...
@@ -618,7 +619,43 @@ class Buildout(dict):
)
for
ep
in
pkg_resources
.
iter_entry_points
(
'zc.buildout.extension'
):
ep
.
load
()(
self
)
def
runsetup
(
self
,
args
):
setup
=
args
.
pop
(
0
)
if
os
.
path
.
isdir
(
setup
):
setup
=
os
.
path
.
join
(
setup
,
'setup.py'
)
self
.
_logger
.
info
(
"Running setup script %s"
,
setup
)
setup
=
os
.
path
.
abspath
(
setup
)
setuptools
=
pkg_resources
.
working_set
.
find
(
pkg_resources
.
Requirement
.
parse
(
'setuptools'
)
).
location
fd
,
tsetup
=
tempfile
.
mkstemp
()
try
:
os
.
write
(
fd
,
runsetup_template
%
dict
(
setuptools
=
setuptools
,
setupdir
=
os
.
path
.
dirname
(
setup
),
setup
=
setup
,
))
os
.
spawnl
(
os
.
P_WAIT
,
sys
.
executable
,
sys
.
executable
,
tsetup
,
*
[
zc
.
buildout
.
easy_install
.
_safe_arg
(
a
)
for
a
in
args
])
finally
:
os
.
close
(
fd
)
os
.
remove
(
tsetup
)
runsetup_template
=
"""
import sys
sys.path.insert(0, %(setuptools)r)
import os, setuptools
os.chdir(%(setupdir)r)
sys.argv[0] = %(setup)r
execfile(%(setup)r)
"""
_spacey_nl
=
re
.
compile
(
'[
\
t
\
r
\
f
\
v
]*
\
n
[
\
t
\
r
\
f
\
v
\
n
]*'
...
...
@@ -842,7 +879,7 @@ def main(args=None):
if
args
:
command
=
args
.
pop
(
0
)
if
command
not
in
(
'install'
,
'bootstrap'
):
if
command
not
in
(
'install'
,
'bootstrap'
,
'runsetup'
):
_error
(
'invalid command:'
,
command
)
else
:
command
=
'install'
...
...
src/zc/buildout/runsetup.txt
0 → 100644
View file @
e87c4bdf
Running setup scripts
=====================
Buildouts are often used to work on packages that will be distributed
as eggs. During development, we use develop eggs. When you've
completed a development cycle, you'll need to run your setup script to
generate a distribution and, perhaps, uploaded it to the Python
package index. If your script uses setuptools, you'll need setuptools
in your Python path, which may be an issue if you haven't installed
setuptools into your Python installation.
The buildout runsetup command is helpful in a situation like this. It
can be used to run a setup script and it does so with the setuptools
egg in the Python path and with setuptools already imported. The fact
that setuptools is imported means that you can use setuptools-based
commands, like bdist_egg even with packages that don't use setuptools.
To illustrate this, we'll create a package in a sample buildout:
>>> mkdir(sample_buildout, 'hello')
>>> write(sample_buildout, 'hello', 'hello.py', 'print "Hello World!"')
>>> write(sample_buildout, 'hello', 'README', 'This is hello')
>>> write(sample_buildout, 'hello', 'setup.py',
... """
... from distutils.core import setup
... setup(name="hello",
... version="1.0",
... py_modules=["hello"],
... author="Bob",
... author_email="bob@foo.com",
... )
... """)
We can use the buildout command to generate the hello egg:
>>> cd(sample_buildout)
>>> import os
>>> print system(os.path.join('bin', 'buildout')
... +' runsetup hello -q bdist_egg'),
buildout: Running setup script hello/setup.py
zip_safe flag not set; analyzing archive contents...
The hello directory now has a hello egg in it's dist directory:
>>> ls(sample_buildout, 'hello', 'dist')
- hello-1.0-py2.4.egg
src/zc/buildout/tests.py
View file @
e87c4bdf
...
...
@@ -512,7 +512,7 @@ def updateSetup(test):
def
test_suite
():
return
unittest
.
TestSuite
((
doctest
.
DocFileSuite
(
'buildout.txt'
,
'buildout.txt'
,
'runsetup.txt'
,
setUp
=
zc
.
buildout
.
testing
.
buildoutSetUp
,
tearDown
=
zc
.
buildout
.
testing
.
buildoutTearDown
,
checker
=
renormalizing
.
RENormalizing
([
...
...
@@ -530,6 +530,8 @@ def test_suite():
(re.compile('
(
\
n
?
)
-
([
a
-
zA
-
Z_
.
-
]
+
)
-
script
.
py
\
n
-
\\
2.
exe
\
n
'),
'
\\
1
-
\\
2
\
n
'),
(re.compile("(
\
w)%s(
\
w)" % os_path_sep), r"
\
1
/
\
2
"),
(re.compile('
hello
-
1
[.]
0
-
py
\
d
[.]
\
d
[.]
egg
'),
'
hello
-
1.0
-
py2
.
4.
egg
')
])
),
...
...
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