Hello community,
here is the log from the commit of package python3-setuptools for
openSUSE:Factory checked in at 2015-01-27 09:08:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-setuptools (Old)
and /work/SRC/openSUSE:Factory/.python3-setuptools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-setuptools"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-setuptools/python3-setuptools.changes
2015-01-21 21:54:40.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python3-setuptools.new/python3-setuptools.changes
2015-01-27 09:08:36.000000000 +0100
@@ -1,0 +2,6 @@
+Sun Jan 25 17:22:09 UTC 2015 - [email protected]
+
+- update to version 12.0.4:
+ * Issue #335: Fix script header generation on Windows.
+
+-------------------------------------------------------------------
Old:
----
setuptools-12.0.3.tar.gz
New:
----
setuptools-12.0.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-setuptools.spec ++++++
--- /var/tmp/diff_new_pack.p43UGp/_old 2015-01-27 09:08:37.000000000 +0100
+++ /var/tmp/diff_new_pack.p43UGp/_new 2015-01-27 09:08:37.000000000 +0100
@@ -17,7 +17,7 @@
Name: python3-setuptools
-Version: 12.0.3
+Version: 12.0.4
Release: 0
Url: http://pypi.python.org/pypi/setuptools
Summary: Easily download, build, install, upgrade, and uninstall Python
packages
++++++ setuptools-12.0.3.tar.gz -> setuptools-12.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/CHANGES.txt
new/setuptools-12.0.4/CHANGES.txt
--- old/setuptools-12.0.3/CHANGES.txt 2015-01-19 02:48:13.000000000 +0100
+++ new/setuptools-12.0.4/CHANGES.txt 2015-01-21 04:05:52.000000000 +0100
@@ -3,6 +3,12 @@
=======
------
+12.0.4
+------
+
+* Issue #335: Fix script header generation on Windows.
+
+------
12.0.3
------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/PKG-INFO
new/setuptools-12.0.4/PKG-INFO
--- old/setuptools-12.0.3/PKG-INFO 2015-01-19 02:48:36.000000000 +0100
+++ new/setuptools-12.0.4/PKG-INFO 2015-01-21 04:10:37.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: setuptools
-Version: 12.0.3
+Version: 12.0.4
Summary: Easily download, build, install, upgrade, and uninstall Python
packages
Home-page: https://bitbucket.org/pypa/setuptools
Author: Python Packaging Authority
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/ez_setup.py
new/setuptools-12.0.4/ez_setup.py
--- old/setuptools-12.0.3/ez_setup.py 2015-01-19 02:43:32.000000000 +0100
+++ new/setuptools-12.0.4/ez_setup.py 2015-01-19 02:49:13.000000000 +0100
@@ -36,7 +36,7 @@
except ImportError:
USER_SITE = None
-DEFAULT_VERSION = "12.0.3"
+DEFAULT_VERSION = "12.0.4"
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
def _python_cmd(*args):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/setup.cfg
new/setuptools-12.0.4/setup.cfg
--- old/setuptools-12.0.3/setup.cfg 2015-01-19 02:48:36.000000000 +0100
+++ new/setuptools-12.0.4/setup.cfg 2015-01-21 04:10:37.000000000 +0100
@@ -1,7 +1,7 @@
[egg_info]
tag_build =
-tag_date = 0
tag_svn_revision = 0
+tag_date = 0
[aliases]
release = egg_info -RDb ''
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/setuptools/command/easy_install.py
new/setuptools-12.0.4/setuptools/command/easy_install.py
--- old/setuptools-12.0.3/setuptools/command/easy_install.py 2015-01-19
02:21:47.000000000 +0100
+++ new/setuptools-12.0.4/setuptools/command/easy_install.py 2015-01-21
03:46:27.000000000 +0100
@@ -37,6 +37,7 @@
import contextlib
import subprocess
import shlex
+import io
from setuptools import Command
from setuptools.sandbox import run_setup
@@ -1801,9 +1802,8 @@
def is_sh(executable):
"""Determine if the specified executable is a .sh (contains a #! line)"""
try:
- fp = open(executable)
- magic = fp.read(2)
- fp.close()
+ with io.open(executable, encoding='latin-1') as fp:
+ magic = fp.read(2)
except (OSError, IOError):
return executable
return magic == '#!'
@@ -1845,25 +1845,14 @@
def fix_jython_executable(executable, options):
- if sys.platform.startswith('java') and is_sh(executable):
- # Workaround for Jython is not needed on Linux systems.
- import java
-
- if java.lang.System.getProperty("os.name") == "Linux":
- return executable
-
- # Workaround Jython's sys.executable being a .sh (an invalid
- # shebang line interpreter)
- if options:
- # Can't apply the workaround, leave it broken
- log.warn(
- "WARNING: Unable to adapt shebang line for Jython,"
- " the following script is NOT executable\n"
- " see http://bugs.jython.org/issue1112 for"
- " more information.")
- else:
- return '/usr/bin/env %s' % executable
- return executable
+ warnings.warn("Use JythonCommandSpec", DeprecationWarning, stacklevel=2)
+
+ if not JythonCommandSpec.relevant():
+ return executable
+
+ cmd = CommandSpec.best().from_param(executable)
+ cmd.install_options(options)
+ return cmd.as_header().lstrip('#!').rstrip('\n')
class CommandSpec(list):
@@ -1876,6 +1865,13 @@
split_args = dict()
@classmethod
+ def best(cls):
+ """
+ Choose the best CommandSpec class based on environmental conditions.
+ """
+ return cls if not JythonCommandSpec.relevant() else JythonCommandSpec
+
+ @classmethod
def _sys_executable(cls):
_default = os.path.normpath(sys.executable)
return os.environ.get('__PYVENV_LAUNCHER__', _default)
@@ -1897,7 +1893,7 @@
@classmethod
def from_environment(cls):
- return cls.from_string('"' + cls._sys_executable() + '"')
+ return cls([cls._sys_executable()])
@classmethod
def from_string(cls, string):
@@ -1906,7 +1902,7 @@
line parseable by shlex.split.
"""
items = shlex.split(string, **cls.split_args)
- return JythonCommandSpec.from_string(string) or cls(items)
+ return cls(items)
def install_options(self, script_text):
self.options = shlex.split(self._extract_options(script_text))
@@ -1942,17 +1938,21 @@
class JythonCommandSpec(CommandSpec):
@classmethod
- def from_string(cls, string):
- """
- On Jython, construct an instance of this class.
- On platforms other than Jython, return None.
- """
- needs_jython_spec = (
+ def relevant(cls):
+ return (
sys.platform.startswith('java')
and
__import__('java').lang.System.getProperty('os.name') != 'Linux'
)
- return cls([string]) if needs_jython_spec else None
+
+ @classmethod
+ def from_environment(cls):
+ string = '"' + cls._sys_executable() + '"'
+ return cls.from_string(string)
+
+ @classmethod
+ def from_string(cls, string):
+ return cls([string])
def as_header(self):
"""
@@ -2009,7 +2009,7 @@
warnings.warn("Use get_header", DeprecationWarning)
if wininst:
executable = "python.exe"
- cmd = cls.command_spec_class.from_param(executable)
+ cmd = cls.command_spec_class.best().from_param(executable)
cmd.install_options(script_text)
return cmd.as_header()
@@ -2050,7 +2050,7 @@
@classmethod
def get_header(cls, script_text="", executable=None):
"""Create a #! line, getting options (if any) from script_text"""
- cmd = cls.command_spec_class.from_param(executable)
+ cmd = cls.command_spec_class.best().from_param(executable)
cmd.install_options(script_text)
return cmd.as_header()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools-12.0.3/setuptools/command/install_scripts.py
new/setuptools-12.0.4/setuptools/command/install_scripts.py
--- old/setuptools-12.0.3/setuptools/command/install_scripts.py 2015-01-19
02:45:22.000000000 +0100
+++ new/setuptools-12.0.4/setuptools/command/install_scripts.py 2015-01-21
02:29:54.000000000 +0100
@@ -39,7 +39,7 @@
writer = ei.WindowsScriptWriter
# resolve the writer to the environment
writer = writer.best()
- cmd = writer.command_spec_class.from_param(exec_param)
+ cmd = writer.command_spec_class.best().from_param(exec_param)
for args in writer.get_args(dist, cmd.as_header()):
self.write_script(*args)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/setuptools-12.0.3/setuptools/tests/test_easy_install.py
new/setuptools-12.0.4/setuptools/tests/test_easy_install.py
--- old/setuptools-12.0.3/setuptools/tests/test_easy_install.py 2015-01-19
02:14:42.000000000 +0100
+++ new/setuptools-12.0.4/setuptools/tests/test_easy_install.py 2015-01-21
03:13:37.000000000 +0100
@@ -24,10 +24,7 @@
from setuptools import compat
from setuptools.compat import StringIO, BytesIO, urlparse
from setuptools.sandbox import run_setup
-from setuptools.command.easy_install import (
- easy_install, fix_jython_executable, nt_quote_arg,
- is_sh, ScriptWriter, CommandSpec,
-)
+import setuptools.command.easy_install as ei
from setuptools.command.easy_install import PthDistributions
from setuptools.command import easy_install as easy_install_pkg
from setuptools.dist import Distribution
@@ -50,19 +47,6 @@
def as_requirement(self):
return 'spec'
-WANTED = DALS("""
- #!%s
- # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
- __requires__ = 'spec'
- import sys
- from pkg_resources import load_entry_point
-
- if __name__ == '__main__':
- sys.exit(
- load_entry_point('spec', 'console_scripts', 'name')()
- )
- """) % nt_quote_arg(fix_jython_executable(sys.executable, ""))
-
SETUP_PY = DALS("""
from setuptools import setup
@@ -73,7 +57,7 @@
def test_install_site_py(self):
dist = Distribution()
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.sitepy_installed = False
cmd.install_dir = tempfile.mkdtemp()
try:
@@ -84,18 +68,30 @@
shutil.rmtree(cmd.install_dir)
def test_get_script_args(self):
+ header = ei.CommandSpec.best().from_environment().as_header()
+ expected = header + DALS("""
+ # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
+ __requires__ = 'spec'
+ import sys
+ from pkg_resources import load_entry_point
+
+ if __name__ == '__main__':
+ sys.exit(
+ load_entry_point('spec', 'console_scripts', 'name')()
+ )
+ """)
dist = FakeDist()
- args = next(ScriptWriter.get_args(dist))
+ args = next(ei.ScriptWriter.get_args(dist))
name, script = itertools.islice(args, 2)
- assert script == WANTED
+ assert script == expected
def test_no_find_links(self):
# new option '--no-find-links', that blocks find-links added at
# the project level
dist = Distribution()
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.check_pth_processing = lambda: True
cmd.no_find_links = True
cmd.find_links = ['link1', 'link2']
@@ -105,7 +101,7 @@
assert cmd.package_index.scanned_urls == {}
# let's try without it (default behavior)
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.check_pth_processing = lambda: True
cmd.find_links = ['link1', 'link2']
cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
@@ -154,7 +150,7 @@
#XXX: replace with something meaningfull
dist = Distribution()
dist.script_name = 'setup.py'
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.args = ['py']
cmd.ensure_finalized()
assert cmd.user, 'user should be implied'
@@ -175,7 +171,7 @@
#XXX: replace with something meaningfull
dist = Distribution()
dist.script_name = 'setup.py'
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.args = ['py']
cmd.initialize_options()
assert not cmd.user, 'NOT user should be implied'
@@ -196,7 +192,7 @@
try:
dist = Distribution()
dist.script_name = 'setup.py'
- cmd = easy_install(dist)
+ cmd = ei.easy_install(dist)
cmd.install_dir = target
cmd.args = ['foo']
cmd.ensure_finalized()
@@ -423,24 +419,25 @@
exe_with_spaces = r'C:\Program Files\Python33\python.exe'
@pytest.mark.skipif(
- sys.platform.startswith('java') and is_sh(sys.executable),
+ sys.platform.startswith('java') and ei.is_sh(sys.executable),
reason="Test cannot run under java when executable is sh"
)
def test_get_script_header(self):
- expected = '#!%s\n' % nt_quote_arg(os.path.normpath(sys.executable))
- actual = ScriptWriter.get_script_header('#!/usr/local/bin/python')
+ expected = '#!%s\n' % ei.nt_quote_arg(os.path.normpath(sys.executable))
+ actual = ei.ScriptWriter.get_script_header('#!/usr/local/bin/python')
assert actual == expected
- expected = '#!%s -x\n' % nt_quote_arg(os.path.normpath(sys.executable))
- actual = ScriptWriter.get_script_header('#!/usr/bin/python -x')
+ expected = '#!%s -x\n' % ei.nt_quote_arg(os.path.normpath
+ (sys.executable))
+ actual = ei.ScriptWriter.get_script_header('#!/usr/bin/python -x')
assert actual == expected
- actual = ScriptWriter.get_script_header('#!/usr/bin/python',
+ actual = ei.ScriptWriter.get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe)
expected = '#!%s -x\n' % self.non_ascii_exe
assert actual == expected
- actual = ScriptWriter.get_script_header('#!/usr/bin/python',
+ actual = ei.ScriptWriter.get_script_header('#!/usr/bin/python',
executable='"'+self.exe_with_spaces+'"')
expected = '#!"%s"\n' % self.exe_with_spaces
assert actual == expected
@@ -463,7 +460,7 @@
f.write(header)
exe = str(exe)
- header = ScriptWriter.get_script_header('#!/usr/local/bin/python',
+ header = ei.ScriptWriter.get_script_header('#!/usr/local/bin/python',
executable=exe)
assert header == '#!/usr/bin/env %s\n' % exe
@@ -472,14 +469,14 @@
with contexts.quiet() as (stdout, stderr):
# When options are included, generate a broken shebang line
# with a warning emitted
- candidate = ScriptWriter.get_script_header('#!/usr/bin/python -x',
+ candidate = ei.ScriptWriter.get_script_header('#!/usr/bin/python
-x',
executable=exe)
assert candidate == '#!%s -x\n' % exe
output = locals()[expect_out]
assert 'Unable to adapt shebang line' in output.getvalue()
with contexts.quiet() as (stdout, stderr):
- candidate = ScriptWriter.get_script_header('#!/usr/bin/python',
+ candidate = ei.ScriptWriter.get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe)
assert candidate == '#!%s -x\n' % self.non_ascii_exe
output = locals()[expect_out]
@@ -492,20 +489,20 @@
Show how a custom CommandSpec could be used to specify a #! executable
which takes parameters.
"""
- cmd = CommandSpec(['/usr/bin/env', 'python3'])
+ cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
assert cmd.as_header() == '#!/usr/bin/env python3\n'
def test_from_param_for_CommandSpec_is_passthrough(self):
"""
from_param should return an instance of a CommandSpec
"""
- cmd = CommandSpec(['python'])
- cmd_new = CommandSpec.from_param(cmd)
+ cmd = ei.CommandSpec(['python'])
+ cmd_new = ei.CommandSpec.from_param(cmd)
assert cmd is cmd_new
def test_from_environment_with_spaces_in_executable(self):
with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
- cmd = CommandSpec.from_environment()
+ cmd = ei.CommandSpec.from_environment()
assert len(cmd) == 1
assert cmd.as_header().startswith('#!"')
@@ -514,7 +511,7 @@
In order to support `executable = /usr/bin/env my-python`, make sure
from_param invokes shlex on that input.
"""
- cmd = CommandSpec.from_param('/usr/bin/env my-python')
+ cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
assert len(cmd) == 2
assert '"' not in cmd.as_header()
@@ -522,7 +519,18 @@
"""
CommandSpec.from_string(sys.executable) should contain just that param.
"""
- writer = ScriptWriter.best()
+ writer = ei.ScriptWriter.best()
cmd = writer.command_spec_class.from_string(sys.executable)
assert len(cmd) == 1
assert cmd[0] == sys.executable
+
+
+class TestWindowsScriptWriter:
+ def test_header(self):
+ hdr = ei.WindowsScriptWriter.get_script_header('')
+ assert hdr.startswith('#!')
+ assert hdr.endswith('\n')
+ hdr = hdr.lstrip('#!')
+ hdr = hdr.rstrip('\n')
+ # header should not start with an escaped quote
+ assert not hdr.startswith('\\"')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/setuptools/version.py
new/setuptools-12.0.4/setuptools/version.py
--- old/setuptools-12.0.3/setuptools/version.py 2015-01-19 02:43:32.000000000
+0100
+++ new/setuptools-12.0.4/setuptools/version.py 2015-01-19 02:49:13.000000000
+0100
@@ -1 +1 @@
-__version__ = '12.0.3'
+__version__ = '12.0.4'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/setuptools-12.0.3/setuptools.egg-info/PKG-INFO
new/setuptools-12.0.4/setuptools.egg-info/PKG-INFO
--- old/setuptools-12.0.3/setuptools.egg-info/PKG-INFO 2015-01-19
02:48:34.000000000 +0100
+++ new/setuptools-12.0.4/setuptools.egg-info/PKG-INFO 2015-01-21
04:09:44.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: setuptools
-Version: 12.0.3
+Version: 12.0.4
Summary: Easily download, build, install, upgrade, and uninstall Python
packages
Home-page: https://bitbucket.org/pypa/setuptools
Author: Python Packaging Authority
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]