summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2006-09-06 20:54:28 +0000
committerphillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771>2006-09-06 20:54:28 +0000
commit2054aa32ca0854aafb8bfeb5a708efc4f5500529 (patch)
tree6b6d48adae34f1ebc234f8af464848132d1c00bd /setuptools/command
parent17b3bdcc6e896926f8c317d6ebc67b21894fd771 (diff)
downloadpython-setuptools-2054aa32ca0854aafb8bfeb5a708efc4f5500529.tar.gz
Prevent deprecation warnings coming from generated scripts when
sys.executable contains non-ASCII characters. git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@51790 6015fed2-1504-0410-9fe1-9d1591cc4771
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/develop.py2
-rwxr-xr-xsetuptools/command/easy_install.py22
2 files changed, 12 insertions, 12 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index 9dff7da..499f2ed 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -3,7 +3,7 @@ from distutils.util import convert_path
from pkg_resources import Distribution, PathMetadata, normalize_path
from distutils import log
from distutils.errors import *
-import sys, os
+import sys, os, setuptools
class develop(easy_install):
"""Set up package for development"""
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index a301daf..7c4d6d6 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1408,7 +1408,17 @@ def get_script_header(script_text, executable=sys_executable):
options = match.group(1) or ''
if options:
options = ' '+options
- return "#!%(executable)s%(options)s\n" % locals()
+ hdr = "#!%(executable)s%(options)s\n" % locals()
+ if unicode(hdr,'ascii','ignore').encode('ascii') != hdr:
+ # Non-ascii path to sys.executable, use -x to prevent warnings
+ if options:
+ if options.strip().startswith('-'):
+ options = ' -x'+options.strip()[1:]
+ # else: punt, we can't do it, let the warning happen anyway
+ else:
+ options = ' -x'
+ hdr = "#!%(executable)s%(options)s\n" % locals()
+ return hdr
def auto_chmod(func, arg, exc):
if func is os.remove and os.name=='nt':
@@ -1442,7 +1452,6 @@ def is_python(text, filename='<string>'):
else:
return True
-
def is_python_script(script_text, filename):
"""Is this text, as a whole, a Python script? (as opposed to shell/bat/etc.
"""
@@ -1465,15 +1474,6 @@ def is_python_script(script_text, filename):
return False # Not any Python I can recognize
-
-
-
-
-
-
-
-
-
def get_script_args(dist, executable=sys_executable):
"""Yield write_script() argument tuples for a distribution's entrypoints"""
spec = str(dist.as_requirement())