testing-cabal / unittest-ext

Automatically exported from code.google.com/p/unittest-ext
2 stars 2 forks source link

pypi: can't install unittest2-0.8.0 in --user mode #87

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. non-root$ pip install --user unittest2

What is the expected output? What do you see instead?
Actual output:
Downloading/unpacking unittest2
  Downloading unittest2-0.8.0.tar.gz (78kB): 78kB downloaded
  Running setup.py egg_info for package unittest2

Requirement already satisfied (use --upgrade to upgrade): argparse in 
/usr/lib/python2.7/site-packages (from unittest2)
Requirement already satisfied (use --upgrade to upgrade): six in 
/usr/lib/python2.7/site-packages (from unittest2)
Installing collected packages: unittest2
  Running setup.py install for unittest2
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_prdik/unittest2/setup.py", line 87, in <module>
        setup(**params)
      File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.7/distutils/dist.py", line 971, in run_command
        cmd_obj.ensure_finalized()
      File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 29, in finalize_options
        _install.finalize_options(self)
      File "/usr/lib64/python2.7/distutils/command/install.py", line 336, in finalize_options
        self.create_home_path()
      File "/usr/lib64/python2.7/distutils/command/install.py", line 553, in create_home_path
        if path.startswith(home) and not os.path.isdir(path):
    AttributeError: late_version instance has no attribute 'startswith'
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_prdik/unittest2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yBfMOs-record/install-record.txt --single-version-externally-managed --user:
    running install

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_prdik/unittest2/setup.py", line 87, in <module>

    setup(**params)

  File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup

    dist.run_commands()

  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "/usr/lib64/python2.7/distutils/dist.py", line 971, in run_command

    cmd_obj.ensure_finalized()

  File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized

    self.finalize_options()

  File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 29, in finalize_options

    _install.finalize_options(self)

  File "/usr/lib64/python2.7/distutils/command/install.py", line 336, in finalize_options

    self.create_home_path()

  File "/usr/lib64/python2.7/distutils/command/install.py", line 553, in create_home_path

    if path.startswith(home) and not os.path.isdir(path):

AttributeError: late_version instance has no attribute 'startswith'

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import 
setuptools;__file__='/tmp/pip_build_prdik/unittest2/setup.py';exec(compile(open(
__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record 
/tmp/pip-yBfMOs-record/install-record.txt --single-version-externally-managed 
--user failed with error code 1 in /tmp/pip_build_prdik/unittest2
Storing complete log in /home/prdik/.pip/pip.log

What version of the product are you using? On what operating system?
Fedora20,
python-pip-1.4.1-1.fc20.noarch
python-2.7.5-15.fc20.x86_64

Please provide any additional information below.

Works when installed system-wide (without the --user parameter).

Original issue reported on code.google.com by azeli...@redhat.com on 13 Nov 2014 at 8:43

GoogleCodeExporter commented 9 years ago
Having the same problem over here. Problem stems from this object not 
inheriting from str/basetring.

https://hg.python.org/unittest2/file/bfdcdc6bdb89/setup.py#l13

Original comment by s...@thinkful.com on 27 Nov 2014 at 6:33

GoogleCodeExporter commented 9 years ago
Thanks for the bug report, I don't know if the obvious thing of adding 
startswith will be enough to fix it - the --user code path may trigger 
too-early evaluation of the version (so you might want to try using the wheel 
if you can).

Give this patch a go:

diff -r 6ac850e23513 setup.py
--- a/setup.py  Thu Mar 12 15:42:28 2015 +1300
+++ b/setup.py  Thu Mar 12 15:51:13 2015 +1300
@@ -18,6 +18,8 @@
         return str(self) + other
     def replace(self, old, new):
         return str(self).replace(old, new)
+    def startswith(self, other):
+        return str(self).startswith(other)
 VERSION = late_version()

Original comment by robert.c...@gmail.com on 12 Mar 2015 at 2:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Why not extend basestring instead of object?

Original comment by s...@thinkful.com on 12 Mar 2015 at 3:49