New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py develop fails with some packages on Python3 #218

Closed
bb-migration opened this Issue Jun 5, 2014 · 4 comments

Comments

Projects
None yet
1 participant
@bb-migration

bb-migration commented Jun 5, 2014

Originally reported by: alex_gaynor (Bitbucket: alex_gaynor, GitHub: Unknown)


Instructions for reproduction:

$ git clone git://git.openstack.org/openstack/python-swiftclient.git
$ cd python-swiftclient
$ virtualenv -p python3.3 foo
$ ./foo/bin/pip install -U -r requirements.txt setuptools==4.0.1
$ . foo/bin/activate
$ python setup.py develop

This appears to have been introduced with the 4.0.0 release. Upstream ticket that noticed this issue: https://bugs.launchpad.net/python-swiftclient/+bug/1326972


@bb-migration

This comment has been minimized.

bb-migration commented Jun 6, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Tail end of the traceback is:

    self.install_script(dist, script_name, script_text, script_path)

  File "/Users/alex_gaynor/projects/openstack-swiftclient/.tox/py34/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 762, in install_script

    script_text = (get_script_header(script_text) +

  File "/Users/alex_gaynor/projects/openstack-swiftclient/.tox/py34/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1555, in get_script_header

    first = (script_text+'\n').splitlines()[0]

TypeError: can't concat bytes to str

I guess it's no surprise that when #210 was changed, it created this regression.

My initial instinct is to roll back the change that introduced the issue. I welcome alternative suggestions and especially welcome unit tests that capture these requirements.

@bb-migration

This comment has been minimized.

bb-migration commented Jun 6, 2014

Original comment by davidoff (Bitbucket: davidoff, GitHub: davidoff):


Can we special case python3 or Windows for this?

The reasonning is that on windows the binary script must be open in binary. My initial naive approach breaks because in this part of the code, we still assume that the contents of scripts can only be text.

On unix, this doesn't break because text mode files are not converted, handling binary equally. But then Python3 tells us bytes are is not text...

Maybe we should call is_python_script() to choose the binary flag in the install_egg_scripts in develop command?

I will experiment and issue a pull request.

@bb-migration

This comment has been minimized.

bb-migration commented Jun 9, 2014

Original comment by davidoff (Bitbucket: davidoff, GitHub: davidoff):


Improved implementation in pull request #60.

@bb-migration

This comment has been minimized.

bb-migration commented Jun 14, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Setuptools 3.8.1 supersedes Setuptools 4.x, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment