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
6874dc07
Commit
6874dc07
authored
Apr 18, 2013
by
Reinout van Rees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test: future and docstring in distutils scripts
parent
284e2470
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
src/zc/buildout/easy_install.txt
src/zc/buildout/easy_install.txt
+10
-2
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+2
-0
No files found.
src/zc/buildout/easy_install.txt
View file @
6874dc07
...
...
@@ -962,12 +962,14 @@ It also works for zipped eggs:
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
like for the console_scripts. Note that the second line in the scripts can
contain a source encoding hint; buildout retains it.
like for the console_scripts.
>>> cat(distbin, 'distutilsscript')
#!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
"""Module docstring."""
from __future__ import print_statement
<BLANKLINE>
<BLANKLINE>
import sys
sys.path[0:0] = [
...
...
@@ -977,6 +979,12 @@ contain a source encoding hint; buildout retains it.
<BLANKLINE>
import sys; sys.stdout.write("distutils!\n")
Note that there are several items that need to come first in such a script
*before* buildout's ``sys.path`` statements: a source encoding hint, a module
docstring and ``__future__`` imports. Buildout retains them in their proper
place by looking at the first non-future import and placing its ``sys.path``
statement before that.
Due to the nature of distutils scripts, buildout cannot pass arguments as
there's no specific method to pass them to.
...
...
src/zc/buildout/tests.py
View file @
6874dc07
...
...
@@ -2945,6 +2945,8 @@ def create_sample_eggs(test, executable=sys.executable):
tmp
,
'distutilsscript'
,
'#!/usr/bin/python
\
n
'
'# -*- coding: utf-8 -*-
\
n
'
'"""Module docstring."""
\
n
'
'from __future__ import print_statement
\
n
'
'import sys; sys.stdout.write("distutils!
\
\
n")
\
n
'
)
write
(
...
...
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