[Python-checkins] r51790 - sandbox/trunk/setuptools/setuptools/command/develop.py sandbox/trunk/setuptools/setuptools/command/easy_install.py
phillip.eby
python-checkins at python.org
Wed Sep 6 22:54:28 CEST 2006
Author: phillip.eby
Date: Wed Sep 6 22:54:28 2006
New Revision: 51790
Modified:
sandbox/trunk/setuptools/setuptools/command/develop.py
sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Prevent deprecation warnings coming from generated scripts when
sys.executable contains non-ASCII characters.
Modified: sandbox/trunk/setuptools/setuptools/command/develop.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/develop.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/develop.py Wed Sep 6 22:54:28 2006
@@ -3,7 +3,7 @@
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"""
Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py Wed Sep 6 22:54:28 2006
@@ -1408,7 +1408,17 @@
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 @@
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 @@
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())
More information about the Python-checkins
mailing list