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
Boxiang Sun
slapos.buildout
Commits
625a465e
Commit
625a465e
authored
Jun 02, 2012
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added -S support. Need more tests.
parent
e5c60563
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
src/zc/buildout/isolation.txt
src/zc/buildout/isolation.txt
+88
-0
No files found.
src/zc/buildout/isolation.txt
0 → 100644
View file @
625a465e
Isolation
=========
When developing applications, we recommended that you work with a
minimal Python environment and let buildout install needed
dependencies. If you share a Python environment with other
applications [#simple]_, you're likely to have unexpected
interactions with the other applications, through extra modules or
module version clashes.
There are a number of ways to achive isolation from other
applications:
1. Use a "clean" Python installation that doesn't contain any
non-standard modules.
2. Use a 'virtual environment
<http://pypi.python.org/pypi/virtualenv>'_ that wraps a Python
installation in a way that hides 3rd-party modules.
3. Use the -S Python option when bootstrapping buildout. This will
bypass the normal execution of the Python site.py file, which is
what usually causes directories containing third-party modules to be
added to the Python path on most platforms [#macos]_.
If the -S option is used when bootstrapping buildout, then it will
be remembered by buildout and any scripts generated by buildout
will also use the -S option.
The first option works best in our opinion because, in addition to
isolating you from extra third-party libraries, it protects you from
other changes that a preexisting build might have, such as missing
standard libraries or non-standard Python build options.
This document tests the 3rd option.
>>> sample_buildout = tmpdir('sample')
>>> cd(sample_buildout)
>>> import sys
>>> print system("%s -S %s init demo" % (sys.executable, bootstrap_py)),
... # doctest: +ELLIPSIS
Downloading http://pypi.python.org/packages/source/d/distribute/...
Creating '/sample/buildout.cfg'.
Creating directory '/sample/bin'.
Creating directory '/sample/parts'.
Creating directory '/sample/eggs'.
Creating directory '/sample/develop-eggs'.
Generated script '/sample/bin/buildout'...
Getting distribution for 'zc.recipe.egg'.
Got zc.recipe.egg 1.3.3dev.
Installing py.
Getting distribution for 'demo'.
Got demo 0.4c1.
Getting distribution for 'demoneeded'.
Got demoneeded 1.2c1.
Generated script '/sample/bin/demo'.
Generated interpreter '/sample/bin/py'.
If we look at the scripts generated, se see that the -S option is
provided to the Python executable:
>>> cat('bin', 'buildout') # doctest: +ELLIPSIS
#!/usr/local/bin/python2.7 -S
...
>>> cat('bin', 'demo') # doctest: +ELLIPSIS
#!/usr/local/bin/python2.7 -S
...
>>> cat('bin', 'py') # doctest: +ELLIPSIS
#!/usr/local/bin/python2.7 -S
...
.. [#simple] It's worth noting that system Python builds can make
simple applications easier to build, as hard-to-build extension
modules are already installed or can be easily installed using
system packaging tools.
.. [#macos] On Mac OS X, there are some directories containing
3rd-party libraries that are added to the Python path regardless of
whether site.py is loaded. Still, even on Mac OS X, use of the -S
option prevents some 3rd-party modules from being added to the
Python path,
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