Skip to content
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
ghost opened this issue Jun 5, 2014 · 4 comments
Closed

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

ghost opened this issue Jun 5, 2014 · 4 comments
Labels

Comments

@ghost
Copy link

@ghost ghost 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


@ghost
Copy link
Author

@ghost ghost 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.

@ghost
Copy link
Author

@ghost ghost 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.

@ghost
Copy link
Author

@ghost ghost commented Jun 9, 2014

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


Improved implementation in pull request #60.

@ghost
Copy link
Author

@ghost ghost commented Jun 14, 2014

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


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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
0 participants