Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.buildout
Commits
eb9b1cfc
Commit
eb9b1cfc
authored
Dec 11, 2014
by
Manuel Günther
Browse files
Fixed python3 override of bin/python
parent
09dae18a
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/buildout/python.py
View file @
eb9b1cfc
...
...
@@ -44,18 +44,22 @@ if user_profile and os.path.exists(user_profile):
else:
user_profile_contents = ''
def encode(s):
import sys
if sys.version_info[0] >= 3:
return s.encode('UTF-8')
else:
return s
import tempfile
profile = tempfile.NamedTemporaryFile()
if user_profile_contents:
profile.write('
\\
n
\\
n')
profile.write(user_profile_contents)
profile.write('
\\
n')
profile.write('import pkg_resources #fixes namespace import
\\
n')
profile.write('
\\
n')
profile.write('import os
\\
n')
profile.write('os.unlink("%%s")
\\
n' %% profile.name)
profile.write(encode('
\\
n
\\
n'))
profile.write(encode(user_profile_contents))
profile.write(encode('
\\
n'))
profile.write(encode('import pkg_resources #fixes namespace import
\\
n
\\
nimport os
\\
nos.unlink("%%s")
\\
n' %% profile.name))
if user_profile:
profile.write('os.environ["PYTHONSTARTUP"] = "%%s"
\\
n' %% user_profile)
profile.write(
encode(
'os.environ["PYTHONSTARTUP"] = "%%s"
\\
n' %% user_profile)
)
profile.flush() #makes sure contents are written to the temp file
# overwrites PYTHONSTARTUP for the following process bootstrap
...
...
Write
Preview
Supports
Markdown
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