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
7dc7b399
Commit
7dc7b399
authored
Jul 12, 2013
by
Jim Fulton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #134 from AaronAsAChimp/distutils-from
distutils scripts -- correct order of operations
parents
76a6052f
bb55ca86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
1 deletion
+72
-1
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+1
-1
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+71
-0
No files found.
src/zc/buildout/easy_install.py
View file @
7dc7b399
...
@@ -1107,7 +1107,7 @@ def _distutils_script(path, dest, script_content, initialization, rsetup):
...
@@ -1107,7 +1107,7 @@ def _distutils_script(path, dest, script_content, initialization, rsetup):
for
line_number
,
line
in
enumerate
(
lines
):
for
line_number
,
line
in
enumerate
(
lines
):
if
not
'import'
in
line
:
if
not
'import'
in
line
:
continue
continue
if
not
line
.
startswith
(
'import'
)
or
line
.
startswith
(
'from'
):
if
not
(
line
.
startswith
(
'import'
)
or
line
.
startswith
(
'from'
)
):
continue
continue
if
'__future__'
in
line
:
if
'__future__'
in
line
:
continue
continue
...
...
src/zc/buildout/tests.py
View file @
7dc7b399
...
@@ -2747,6 +2747,77 @@ def test_constrained_requirement():
...
@@ -2747,6 +2747,77 @@ def test_constrained_requirement():
... print_('failed', o, c, g, '!=', e)
... print_('failed', o, c, g, '!=', e)
"""
"""
def
test_distutils_scripts_using_import_are_properly_parsed
():
"""
zc.buildout.easy_install._distutils_script(path, dest, script_content, initialization, rsetup):
Creates a script for a distutils based project. In this example for a
hypothetical code quality checker called 'pyflint' that uses an import
statement to import its code.
>>> pyflint_script = '''#!/path/to/bin/python
... import pyflint.do_something
... pyflint.do_something()
... '''
>>> import sys
>>> original_executable = sys.executable
>>> sys.executable = 'python'
>>> from zc.buildout.easy_install import _distutils_script
>>> _distutils_script('
\
\
'/path/test/
\
\
'', 'bin/pyflint', pyflint_script, '', '')
['bin/pyflint']
>>> cat('bin/pyflint')
#!python
<BLANKLINE>
<BLANKLINE>
import sys
sys.path[0:0] = [
'/path/test/',
]
<BLANKLINE>
<BLANKLINE>
import pyflint.do_something
pyflint.do_something()
>>> sys.executable = original_executable
"""
def
test_distutils_scripts_using_from_are_properly_parsed
():
"""
zc.buildout.easy_install._distutils_script(path, dest, script_content, initialization, rsetup):
Creates a script for a distutils based project. In this example for a
hypothetical code quality checker called 'pyflint' that uses a from
statement to import its code.
>>> pyflint_script = '''#!/path/to/bin/python
... from pyflint import do_something
... do_something()
... '''
>>> import sys
>>> original_executable = sys.executable
>>> sys.executable = 'python'
>>> from zc.buildout.easy_install import _distutils_script
>>> _distutils_script('
\
\
'/path/test/
\
\
'', 'bin/pyflint', pyflint_script, '', '')
['bin/pyflint']
>>> cat('bin/pyflint')
#!python
<BLANKLINE>
<BLANKLINE>
import sys
sys.path[0:0] = [
'/path/test/',
]
<BLANKLINE>
<BLANKLINE>
from pyflint import do_something
do_something()
>>> sys.executable = original_executable
"""
def
want_new_zcrecipeegg
():
def
want_new_zcrecipeegg
():
"""
"""
>>> write('buildout.cfg',
>>> write('buildout.cfg',
...
...
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