[Python-modules-commits] [python-pex] 01/05: Import python-pex_1.1.6.orig.tar.gz

Barry Warsaw barry at moszumanska.debian.org
Mon May 9 20:12:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

barry pushed a commit to branch master
in repository python-pex.

commit f82c7318c880c46280745b20846781313a8dab12
Author: Barry Warsaw <barry at python.org>
Date:   Mon May 9 16:00:00 2016 -0400

    Import python-pex_1.1.6.orig.tar.gz
---
 CHANGES.rst                        | 35 +++++++++++++++++++++++++-
 PKG-INFO                           | 37 ++++++++++++++++++++++++++--
 pex.egg-info/PKG-INFO              | 37 ++++++++++++++++++++++++++--
 pex.egg-info/SOURCES.txt           |  2 ++
 pex.egg-info/requires.txt          |  2 +-
 pex/commands/bdist_pex.py          | 34 +++++++++++++++++++-------
 pex/compatibility.py               |  8 ++++++
 pex/package.py                     |  6 ++---
 pex/pex.py                         | 24 ++++++++++--------
 pex/pex_builder.py                 | 11 ++++++---
 pex/version.py                     |  6 ++---
 tests/test_bdist_pex.py            | 50 ++++++++++++++++++++++++++++++++++++++
 tests/test_inherits_path_option.py | 41 +++++++++++++++++++++++++++++++
 tests/test_package.py              | 11 ++++++++-
 tests/test_pex_builder.py          | 38 +++++++++++++++++------------
 tox.ini                            | 28 +++++++++++++++------
 16 files changed, 311 insertions(+), 59 deletions(-)

diff --git a/CHANGES.rst b/CHANGES.rst
index b6af105..c2bb13a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -3,12 +3,45 @@ CHANGES
 =======
 
 -----
+1.1.6
+-----
+
+This release is a quick fix for a regression that inadvertently went out in 1.1.5 (Issue #243).
+
+* Fix the ``bdist_pex`` ``setuptools`` command to work for python2.
+  `#246 <https://github.com/pantsbuild/pex/pull/246>`_
+  `Fixes #243 <https://github.com/pantsbuild/pex/issues/243>`_
+
+* Upgrade pex dependencies on ``setuptools`` and ``wheel``.
+  `#244 <https://github.com/pantsbuild/pex/pull/244>`_
+  `Fixes #238 <https://github.com/pantsbuild/pex/issues/238>`_
+
+-----
+1.1.5
+-----
+
+* Fix ``PEXBuilder.clone`` and thus ``bdist_pex --pex-args`` for ``--python`` and ``--python-shebang``.
+  `#234 <https://github.com/pantsbuild/pex/pull/234>`_
+  `Fixes #233 <https://github.com/pantsbuild/pex/issues/233>`_
+
+* Fix old ``pkg_resources`` egg version normalization.
+  `#227 <https://github.com/pantsbuild/pex/pull/227>`_
+  `Fixes #226 <https://github.com/pantsbuild/pex/issues/226>`_
+
+* Fix the ``inherit_path`` handling.
+  `#224 <https://github.com/pantsbuild/pex/pull/224>`_
+
+* Fix handling of bad distribution script names when used as the pex entrypoint.
+  `#221 <https://github.com/pantsbuild/pex/issues/221>`_
+  `Fixes #220 <https://github.com/pantsbuild/pex/issues/220>`_
+
+-----
 1.1.4
 -----
 
 This release is a quick fix for a regression that inadvertently went out in 1.1.3 (Issue #216).
 
-* Add a test for the regression in `FixedEggMetadata._zipinfo_name` and revert the breaking commit.
+* Add a test for the regression in ``FixedEggMetadata._zipinfo_name`` and revert the breaking commit.
   `Fixes #216 <https://github.com/pantsbuild/pex/issues/216>`_
 
 -----
diff --git a/PKG-INFO b/PKG-INFO
index 49867c0..0341c9d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pex
-Version: 1.1.4
+Version: 1.1.6
 Summary: The PEX packaging toolchain.
 Home-page: https://github.com/pantsbuild/pex
 Author: UNKNOWN
@@ -11,12 +11,45 @@ Description: =======
         =======
         
         -----
+        1.1.6
+        -----
+        
+        This release is a quick fix for a regression that inadvertently went out in 1.1.5 (Issue #243).
+        
+        * Fix the ``bdist_pex`` ``setuptools`` command to work for python2.
+          `#246 <https://github.com/pantsbuild/pex/pull/246>`_
+          `Fixes #243 <https://github.com/pantsbuild/pex/issues/243>`_
+        
+        * Upgrade pex dependencies on ``setuptools`` and ``wheel``.
+          `#244 <https://github.com/pantsbuild/pex/pull/244>`_
+          `Fixes #238 <https://github.com/pantsbuild/pex/issues/238>`_
+        
+        -----
+        1.1.5
+        -----
+        
+        * Fix ``PEXBuilder.clone`` and thus ``bdist_pex --pex-args`` for ``--python`` and ``--python-shebang``.
+          `#234 <https://github.com/pantsbuild/pex/pull/234>`_
+          `Fixes #233 <https://github.com/pantsbuild/pex/issues/233>`_
+        
+        * Fix old ``pkg_resources`` egg version normalization.
+          `#227 <https://github.com/pantsbuild/pex/pull/227>`_
+          `Fixes #226 <https://github.com/pantsbuild/pex/issues/226>`_
+        
+        * Fix the ``inherit_path`` handling.
+          `#224 <https://github.com/pantsbuild/pex/pull/224>`_
+        
+        * Fix handling of bad distribution script names when used as the pex entrypoint.
+          `#221 <https://github.com/pantsbuild/pex/issues/221>`_
+          `Fixes #220 <https://github.com/pantsbuild/pex/issues/220>`_
+        
+        -----
         1.1.4
         -----
         
         This release is a quick fix for a regression that inadvertently went out in 1.1.3 (Issue #216).
         
-        * Add a test for the regression in `FixedEggMetadata._zipinfo_name` and revert the breaking commit.
+        * Add a test for the regression in ``FixedEggMetadata._zipinfo_name`` and revert the breaking commit.
           `Fixes #216 <https://github.com/pantsbuild/pex/issues/216>`_
         
         -----
diff --git a/pex.egg-info/PKG-INFO b/pex.egg-info/PKG-INFO
index 49867c0..0341c9d 100644
--- a/pex.egg-info/PKG-INFO
+++ b/pex.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pex
-Version: 1.1.4
+Version: 1.1.6
 Summary: The PEX packaging toolchain.
 Home-page: https://github.com/pantsbuild/pex
 Author: UNKNOWN
@@ -11,12 +11,45 @@ Description: =======
         =======
         
         -----
+        1.1.6
+        -----
+        
+        This release is a quick fix for a regression that inadvertently went out in 1.1.5 (Issue #243).
+        
+        * Fix the ``bdist_pex`` ``setuptools`` command to work for python2.
+          `#246 <https://github.com/pantsbuild/pex/pull/246>`_
+          `Fixes #243 <https://github.com/pantsbuild/pex/issues/243>`_
+        
+        * Upgrade pex dependencies on ``setuptools`` and ``wheel``.
+          `#244 <https://github.com/pantsbuild/pex/pull/244>`_
+          `Fixes #238 <https://github.com/pantsbuild/pex/issues/238>`_
+        
+        -----
+        1.1.5
+        -----
+        
+        * Fix ``PEXBuilder.clone`` and thus ``bdist_pex --pex-args`` for ``--python`` and ``--python-shebang``.
+          `#234 <https://github.com/pantsbuild/pex/pull/234>`_
+          `Fixes #233 <https://github.com/pantsbuild/pex/issues/233>`_
+        
+        * Fix old ``pkg_resources`` egg version normalization.
+          `#227 <https://github.com/pantsbuild/pex/pull/227>`_
+          `Fixes #226 <https://github.com/pantsbuild/pex/issues/226>`_
+        
+        * Fix the ``inherit_path`` handling.
+          `#224 <https://github.com/pantsbuild/pex/pull/224>`_
+        
+        * Fix handling of bad distribution script names when used as the pex entrypoint.
+          `#221 <https://github.com/pantsbuild/pex/issues/221>`_
+          `Fixes #220 <https://github.com/pantsbuild/pex/issues/220>`_
+        
+        -----
         1.1.4
         -----
         
         This release is a quick fix for a regression that inadvertently went out in 1.1.3 (Issue #216).
         
-        * Add a test for the regression in `FixedEggMetadata._zipinfo_name` and revert the breaking commit.
+        * Add a test for the regression in ``FixedEggMetadata._zipinfo_name`` and revert the breaking commit.
           `Fixes #216 <https://github.com/pantsbuild/pex/issues/216>`_
         
         -----
diff --git a/pex.egg-info/SOURCES.txt b/pex.egg-info/SOURCES.txt
index 6f48eac..abcde09 100644
--- a/pex.egg-info/SOURCES.txt
+++ b/pex.egg-info/SOURCES.txt
@@ -61,6 +61,7 @@ scripts/combine_coverage.py
 scripts/coverage.sh
 scripts/do_nothing.py
 tests/test_archiver.py
+tests/test_bdist_pex.py
 tests/test_compatibility.py
 tests/test_compiler.py
 tests/test_crawler.py
@@ -68,6 +69,7 @@ tests/test_environment.py
 tests/test_fetcher.py
 tests/test_finders.py
 tests/test_http.py
+tests/test_inherits_path_option.py
 tests/test_integration.py
 tests/test_interpreter.py
 tests/test_iterator.py
diff --git a/pex.egg-info/requires.txt b/pex.egg-info/requires.txt
index 4ea40c9..6a1f6fc 100644
--- a/pex.egg-info/requires.txt
+++ b/pex.egg-info/requires.txt
@@ -1 +1 @@
-setuptools>=2.2,<20
+setuptools>=2.2,<20.11
diff --git a/pex/commands/bdist_pex.py b/pex/commands/bdist_pex.py
index 7a261f2..92c6e32 100644
--- a/pex/commands/bdist_pex.py
+++ b/pex/commands/bdist_pex.py
@@ -5,6 +5,7 @@ from setuptools import Command
 
 from pex.bin.pex import build_pex, configure_clp
 from pex.common import die
+from pex.compatibility import ConfigParser, StringIO, string
 from pex.variables import ENV
 
 
@@ -38,6 +39,29 @@ class bdist_pex(Command):  # noqa
 
     builder.build(target)
 
+  def parse_entry_points(self):
+    def split_and_strip(entry_point):
+      console_script, entry_point = entry_point.split('=', 2)
+      return console_script.strip(), entry_point.strip()
+
+    raw_entry_points = self.distribution.entry_points
+
+    if isinstance(raw_entry_points, string):
+      parser = ConfigParser()
+      parser.readfp(StringIO(raw_entry_points))
+      if parser.has_section('console_scripts'):
+        return dict(parser.items('console_scripts'))
+    elif isinstance(raw_entry_points, dict):
+      try:
+        return dict(split_and_strip(script)
+            for script in raw_entry_points.get('console_scripts', []))
+      except ValueError:
+        pass
+    elif raw_entry_points is not None:
+      die('When entry_points is provided, it must be a string or dict.')
+
+    return {}
+
   def run(self):
     name = self.distribution.get_name()
     version = self.distribution.get_version()
@@ -58,15 +82,7 @@ class bdist_pex(Command):  # noqa
     with ENV.patch(PEX_VERBOSE=str(options.verbosity)):
       pex_builder = build_pex(reqs, options, options_builder)
 
-    def split_and_strip(entry_point):
-      console_script, entry_point = entry_point.split('=', 2)
-      return console_script.strip(), entry_point.strip()
-
-    try:
-      console_scripts = dict(split_and_strip(script)
-          for script in self.distribution.entry_points.get('console_scripts', []))
-    except ValueError:
-      console_scripts = {}
+    console_scripts = self.parse_entry_points()
 
     target = os.path.join(self.bdist_dir, name + '-' + version + '.pex')
     if self.bdist_all:
diff --git a/pex/compatibility.py b/pex/compatibility.py
index 97139e1..bc786bf 100644
--- a/pex/compatibility.py
+++ b/pex/compatibility.py
@@ -23,6 +23,13 @@ except ImportError:
     from io import StringIO
     from io import BytesIO
 
+try:
+  # Python 2.x
+  from ConfigParser import ConfigParser
+except ImportError:
+  # Python 3.x
+  from configparser import ConfigParser
+
 AbstractClass = ABCMeta('AbstractClass', (object,), {})
 PY2 = sys_version_info[0] == 2
 PY3 = sys_version_info[0] == 3
@@ -94,6 +101,7 @@ WINDOWS = os.name == 'nt'
 __all__ = (
   'AbstractClass',
   'BytesIO',
+  'ConfigParser',
   'PY2',
   'PY3',
   'StringIO',
diff --git a/pex/package.py b/pex/package.py
index a432aed..f786729 100644
--- a/pex/package.py
+++ b/pex/package.py
@@ -3,7 +3,7 @@
 
 import os
 
-from pkg_resources import EGG_NAME, parse_version, safe_name
+from pkg_resources import EGG_NAME, parse_version, safe_name, safe_version
 
 from .archiver import Archiver
 from .base import maybe_requirement
@@ -133,7 +133,7 @@ class SourcePackage(Package):
 
   @property
   def raw_version(self):
-    return self._raw_version
+    return safe_version(self._raw_version)
 
   # SourcePackages are always compatible as they can be translated to a distribution.
   def compatible(self, identity, platform=Platform.current()):
@@ -167,7 +167,7 @@ class EggPackage(Package):
 
   @property
   def raw_version(self):
-    return self._raw_version
+    return safe_version(self._raw_version)
 
   @property
   def py_version(self):
diff --git a/pex/pex.py b/pex/pex.py
index d338769..0d5f108 100644
--- a/pex/pex.py
+++ b/pex/pex.py
@@ -154,7 +154,7 @@ class PEX(object):  # noqa: T000
     return new_modules
 
   @classmethod
-  def minimum_sys_path(cls, site_libs):
+  def minimum_sys_path(cls, site_libs, inherit_path):
     site_distributions = OrderedSet()
     user_site_distributions = OrderedSet()
 
@@ -171,13 +171,16 @@ class PEX(object):  # noqa: T000
 
     user_site_distributions.update(all_distribution_paths(USER_SITE))
 
-    for path in site_distributions:
-      TRACER.log('Scrubbing from site-packages: %s' % path)
-
     for path in user_site_distributions:
       TRACER.log('Scrubbing from user site: %s' % path)
 
-    scrub_paths = site_distributions | user_site_distributions
+    if inherit_path:
+      scrub_paths = user_site_distributions
+    else:
+      scrub_paths = site_distributions | user_site_distributions
+      for path in site_distributions:
+        TRACER.log('Scrubbing from site-packages: %s' % path)
+
     scrubbed_sys_path = list(OrderedSet(sys.path) - scrub_paths)
     scrub_from_importer_cache = filter(
       lambda key: any(key.startswith(path) for path in scrub_paths),
@@ -191,7 +194,7 @@ class PEX(object):  # noqa: T000
     return scrubbed_sys_path, scrubbed_importer_cache
 
   @classmethod
-  def minimum_sys(cls):
+  def minimum_sys(cls, inherit_path):
     """Return the minimum sys necessary to run this interpreter, a la python -S.
 
     :returns: (sys.path, sys.path_importer_cache, sys.modules) tuple of a
@@ -205,7 +208,7 @@ class PEX(object):  # noqa: T000
       site_libs.add(extras_path)
     site_libs = set(os.path.normpath(path) for path in site_libs)
 
-    sys_path, sys_path_importer_cache = cls.minimum_sys_path(site_libs)
+    sys_path, sys_path_importer_cache = cls.minimum_sys_path(site_libs, inherit_path)
     sys_modules = cls.minimum_sys_modules(site_libs)
 
     return sys_path, sys_path_importer_cache, sys_modules
@@ -234,7 +237,7 @@ class PEX(object):  # noqa: T000
   # considered a reversible operation despite being a contextmanager.
   @classmethod
   @contextmanager
-  def patch_sys(cls):
+  def patch_sys(cls, inherit_path):
     """Patch sys with all site scrubbed."""
     def patch_dict(old_value, new_value):
       old_value.clear()
@@ -247,7 +250,7 @@ class PEX(object):  # noqa: T000
 
     old_sys_path, old_sys_path_importer_cache, old_sys_modules = (
         sys.path[:], sys.path_importer_cache.copy(), sys.modules.copy())
-    new_sys_path, new_sys_path_importer_cache, new_sys_modules = cls.minimum_sys()
+    new_sys_path, new_sys_path_importer_cache, new_sys_modules = cls.minimum_sys(inherit_path)
 
     patch_all(new_sys_path, new_sys_path_importer_cache, new_sys_modules)
     yield
@@ -314,7 +317,8 @@ class PEX(object):  # noqa: T000
     """
     teardown_verbosity = self._vars.PEX_TEARDOWN_VERBOSE
     try:
-      with self.patch_sys():
+      pex_inherit_path = self._vars.PEX_INHERIT_PATH or self._pex_info.inherit_path
+      with self.patch_sys(pex_inherit_path):
         working_set = self._activate()
         TRACER.log('PYTHONPATH contains:')
         for element in sys.path:
diff --git a/pex/pex_builder.py b/pex/pex_builder.py
index 0641125..b33bde7 100644
--- a/pex/pex_builder.py
+++ b/pex/pex_builder.py
@@ -113,7 +113,10 @@ class PEXBuilder(object):
     clone = self.__class__(
         chroot=chroot_clone,
         interpreter=self._interpreter,
-        pex_info=self._pex_info.copy())
+        pex_info=self._pex_info.copy(),
+        preamble=self._preamble,
+        copy=self._copy)
+    clone.set_shebang(self._shebang)
     for dist in self._distributions:
       clone.add_distribution(dist)
     return clone
@@ -211,7 +214,7 @@ class PEXBuilder(object):
 
     raise self.InvalidExecutableSpecification(
         'Could not find script %r in any distribution %s within PEX!' % (
-            script, ', '.join(self._distributions)))
+            script, ', '.join(str(d) for d in self._distributions)))
 
   def set_entry_point(self, entry_point):
     """Set the entry point of this PEX environment.
@@ -236,10 +239,10 @@ class PEXBuilder(object):
     used to override the default behavior which is to have a #!/usr/bin/env line referencing an
     interpreter compatible with the one used to build the PEX.
 
-    :param shebang: The shebang line minus the #!.
+    :param shebang: The shebang line. If it does not include the leading '#!' it will be added.
     :type shebang: str
     """
-    self._shebang = '#!%s' % shebang
+    self._shebang = '#!%s' % shebang if not shebang.startswith('#!') else shebang
 
   def _add_dist_dir(self, path, dist_name):
     for root, _, files in os.walk(path):
diff --git a/pex/version.py b/pex/version.py
index 1366236..6d0bff0 100644
--- a/pex/version.py
+++ b/pex/version.py
@@ -1,7 +1,7 @@
 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
 # Licensed under the Apache License, Version 2.0 (see LICENSE).
 
-__version__ = '1.1.4'
+__version__ = '1.1.6'
 
-SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20'
-WHEEL_REQUIREMENT = 'wheel>=0.24.0,<0.27.0'
+SETUPTOOLS_REQUIREMENT = 'setuptools>=2.2,<20.11'
+WHEEL_REQUIREMENT = 'wheel>=0.24.0,<0.30.0'
diff --git a/tests/test_bdist_pex.py b/tests/test_bdist_pex.py
new file mode 100644
index 0000000..1486f7a
--- /dev/null
+++ b/tests/test_bdist_pex.py
@@ -0,0 +1,50 @@
+# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
+# Licensed under the Apache License, Version 2.0 (see LICENSE).
+
+import os
+import subprocess
+import sys
+from textwrap import dedent
+
+from twitter.common.contextutil import pushd
+
+from pex.testing import temporary_content
+
+
+def assert_entry_points(entry_points):
+  setup_py = dedent("""
+      from setuptools import setup
+
+      setup(
+        name='my_app',
+        version='0.0.0',
+        zip_safe=True,
+        packages=[''],
+        entry_points=%(entry_points)r,
+      )
+    """ % dict(entry_points=entry_points))
+
+  my_app = dedent("""
+      def do_something():
+        print("hello world!")
+    """)
+
+  with temporary_content({'setup.py': setup_py, 'my_app.py': my_app}) as project_dir:
+    with pushd(project_dir):
+      subprocess.check_call([sys.executable, 'setup.py', 'bdist_pex'])
+      process = subprocess.Popen([os.path.join(project_dir, 'dist', 'my_app-0.0.0.pex')],
+                                 stdout=subprocess.PIPE)
+      stdout, _ = process.communicate()
+      assert 0 == process.returncode
+      assert stdout == b'hello world!\n'
+
+
+def test_entry_points_dict():
+  assert_entry_points({'console_scripts': ['my_app = my_app:do_something']})
+
+
+def test_entry_points_ini_string():
+  assert_entry_points(dedent("""
+      [console_scripts]
+      my_app=my_app:do_something
+    """))
diff --git a/tests/test_inherits_path_option.py b/tests/test_inherits_path_option.py
new file mode 100644
index 0000000..ee8edc7
--- /dev/null
+++ b/tests/test_inherits_path_option.py
@@ -0,0 +1,41 @@
+# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
+# Licensed under the Apache License, Version 2.0 (see LICENSE).
+
+import os
+from contextlib import contextmanager
+
+from twitter.common.contextutil import environment_as, temporary_dir
+
+from pex.pex_builder import PEXBuilder
+from pex.testing import run_simple_pex
+
+
+ at contextmanager
+def write_and_run_simple_pex(inheriting=False):
+  """Write a pex file that contains an executable entry point
+
+  :param inheriting: whether this pex should inherit site-packages paths
+  :type inheriting: bool
+  """
+  with temporary_dir() as td:
+    pex_path = os.path.join(td, 'show_path.pex')
+    with open(os.path.join(td, 'exe.py'), 'w') as fp:
+      fp.write('')  # No contents, we just want the startup messages
+
+    pb = PEXBuilder(path=td, preamble=None)
+    pb.info.inherit_path = inheriting
+    pb.set_executable(os.path.join(td, 'exe.py'))
+    pb.freeze()
+    pb.build(pex_path)
+    with environment_as(PEX_VERBOSE='1'):
+      yield run_simple_pex(pex_path)[0]
+
+
+def test_inherits_path_option():
+  with write_and_run_simple_pex(inheriting=True) as so:
+    assert 'Scrubbing from site-packages' not in str(so), 'Site packages should not be scrubbed.'
+
+
+def test_does_not_inherit_path_option():
+  with write_and_run_simple_pex(inheriting=False) as so:
+    assert 'Scrubbing from site-packages' in str(so), 'Site packages should be scrubbed.'
diff --git a/tests/test_package.py b/tests/test_package.py
index 87a7dbf..58effb1 100644
--- a/tests/test_package.py
+++ b/tests/test_package.py
@@ -44,9 +44,18 @@ def test_egg_packages():
   for req in ('foo', 'bar==0.4.1'):
     assert not el.satisfies(req)
 
+  # Legacy pkg_resources normalized version numbers.
+  el = EggPackage('pyfoo-1.0.0_bar-py2.7-linux-x86_64.egg')
+  assert el.name == 'pyfoo'
+  assert el.raw_version == '1.0.0-bar'
+  assert el.py_version == '2.7'
+  assert el.platform == 'linux-x86_64'
+  for req in ('pyfoo', 'pyfoo==1.0.0-bar'):
+    assert el.satisfies(req)
+
   el = EggPackage('pytz-2012b-py2.6.egg')
   assert el.name == 'pytz'
-  assert el.raw_version == '2012b'
+  assert el.raw_version == '2012b0'
   assert el.py_version == '2.6'
   assert el.platform is None
 
diff --git a/tests/test_pex_builder.py b/tests/test_pex_builder.py
index 91553dd..cfd2a9e 100644
--- a/tests/test_pex_builder.py
+++ b/tests/test_pex_builder.py
@@ -58,15 +58,19 @@ def test_pex_builder():
 
 
 def test_pex_builder_shebang():
-  pb = PEXBuilder()
-  pb.set_shebang('foobar')
+  def builder(shebang):
+    pb = PEXBuilder()
+    pb.set_shebang(shebang)
+    return pb
 
-  with temporary_dir() as td:
-    target = os.path.join(td, 'foo.pex')
-    pb.build(target)
-    expected_preamble = b'#!foobar\n'
-    with open(target, 'rb') as fp:
-      assert fp.read(len(expected_preamble)) == expected_preamble
+  for pb in builder('foobar'), builder('#!foobar'):
+    for b in pb, pb.clone():
+      with temporary_dir() as td:
+        target = os.path.join(td, 'foo.pex')
+        b.build(target)
+        expected_preamble = b'#!foobar\n'
+        with open(target, 'rb') as fp:
+          assert fp.read(len(expected_preamble)) == expected_preamble
 
 
 def test_pex_builder_compilation():
@@ -114,13 +118,17 @@ def test_pex_builder_copy_or_link():
       pb = PEXBuilder(path, copy=copy)
       pb.add_source(src, 'exe.py')
 
-      s1 = os.stat(src)
-      s2 = os.stat(os.path.join(path, 'exe.py'))
-      is_link = (s1[stat.ST_INO], s1[stat.ST_DEV]) == (s2[stat.ST_INO], s2[stat.ST_DEV])
-      if copy:
-        assert not is_link
-      else:
-        assert is_link
+      path_clone = os.path.join(path, '__clone')
+      pb.clone(into=path_clone)
+
+      for root in path, path_clone:
+        s1 = os.stat(src)
+        s2 = os.stat(os.path.join(root, 'exe.py'))
+        is_link = (s1[stat.ST_INO], s1[stat.ST_DEV]) == (s2[stat.ST_INO], s2[stat.ST_DEV])
+        if copy:
+          assert not is_link
+        else:
+          assert is_link
 
     build_and_check(td2, False)
     build_and_check(td3, True)
diff --git a/tox.ini b/tox.ini
index 49cf674..6e480ca 100644
--- a/tox.ini
+++ b/tox.ini
@@ -2,18 +2,18 @@
 skip_missing_interpreters = True
 minversion = 1.8
 envlist =
-	py{py,27,34}-requests,style,isort-check
+	py{py,27,35}-requests,style,isort-check
 
 [testenv]
 commands =
     py.test {posargs:}
 deps =
-    pytest==2.5.2
+    pytest==2.9.1
     twitter.common.contextutil>=0.3.1,<0.4.0
     twitter.common.dirutil>=0.3.1,<0.4.0
     twitter.common.lang>=0.3.1,<0.4.0
     twitter.common.testing>=0.3.1,<0.4.0
-    wheel==0.24.0
+    wheel==0.29.0
     py26: mock
     py27: mock
     pypy: mock
@@ -22,7 +22,7 @@ deps =
     requests: responses
     cachecontrol: CacheControl
     cachecontrol: lockfile
-    coverage: coverage==3.7.1
+    coverage: coverage==4.0.3
 
 [integration]
 commands =
@@ -35,10 +35,16 @@ commands = {[integration]commands}
 [testenv:py27-requests-cachecontrol-coverage]
 commands = {[integration]commands}
 
+[testenv:py34-coverage]
+commands = {[integration]commands}
+
 [testenv:py34-requests-cachecontrol-coverage]
 commands = {[integration]commands}
 
-[testenv:py34-coverage]
+[testenv:py35-coverage]
+commands = {[integration]commands}
+
+[testenv:py35-requests-cachecontrol-coverage]
 commands = {[integration]commands}
 
 [testenv:pypy-requests-cachecontrol-coverage]
@@ -55,7 +61,7 @@ commands =
 [testenv:coverage]
 basepython = python2.7
 deps =
-    coverage==3.7.1
+    coverage==4.0.3
     tox
 commands =
     # meta
@@ -111,10 +117,13 @@ commands = pex {posargs:}
 commands = pex {posargs:}
 
 [testenv:py27-package]
-commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex -e pex.bin.pex:main -v
+commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex27 -e pex.bin.pex:main -v
 
 [testenv:py34-package]
-commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex -e pex.bin.pex:main -v
+commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex34 -e pex.bin.pex:main -v
+
+[testenv:py35-package]
+commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex35 -e pex.bin.pex:main -v
 
 # Would love if you didn't have to enumerate environments here :-\
 [testenv:py26]
@@ -129,6 +138,9 @@ commands = pex --cache-dir {envtmpdir}/buildcache wheel requests . -o dist/pex -
 [testenv:py34]
 [testenv:py34-requests]
 [testenv:py34-requests-cachecontrol]
+[testenv:py35]
+[testenv:py35-requests]
+[testenv:py35-requests-cachecontrol]
 [testenv:pypy]
 [testenv:pypy-requests]
 [testenv:pypy-requests-cachecontrol]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pex.git



More information about the Python-modules-commits mailing list