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

Deb's of python packages have different prefix for binaries and libraries on Ubuntu #480

Closed
romabysen opened this Issue Jul 2, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@romabysen

romabysen commented Jul 2, 2013

deb's created from python packages, be it pypi or local, have their binaries in /usr/bin but their libraries/modules in /usr/local/lib/python/dist-packages/.
Either the binaries should also end up in /usr/local or the libraries in /usr/.

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Jul 2, 2013

Work around: This can be changed by setting the --python-install-bin flag.

Discussion:

Fundamentally, no one will ever agree on one place to have the default location. If I change the default to /usr/local, someone will find it distasteful.

I'm open to discussion, but given I heavily favor backwards compatibility in fpm, it'll be a hard sell to change the current default path. That energy is probably best directed at setting the --python-install-bin /usr/local/bin flag and forgetting this was ever a problem ;)

@romabysen

This comment has been minimized.

romabysen commented Jul 2, 2013

Yes, using --python-install-bin works well but it would be nice if binaries and libraries used the same prefix by default. Funny thing though is that on my system "python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'" returns "/usr/lib/python2.7/dist-packages" but in debs built with fpm python modules end up in "/usr/local/lib/python27/dist-packages/". That seems not quite right to me but maybe it's an Ubuntu probem?

@romabysen

This comment has been minimized.

romabysen commented Jul 2, 2013

I should add that the same happens to RPM's built on the same system (Ubuntu 13.04) but IIRC it does not happen with RPM's built on Amazon Linux. On the other hand, on those RPM's the modules are in "/usr/lib/python2.6/site-packages" while data files are still in "/usr/local".

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Jul 2, 2013

Regarding 'get_python_lib' being different than the install location of setup.py - I believe this is common behavior.

If you take django, for example:

% python setup.py bdist
% tar -ztf dist/Django-1.5.1.linux-x86_64.tar.gz
...
./usr/local/lib/python2.7/dist-packages/django/views/generic/
./usr/local/lib/python2.7/dist-packages/django/views/generic/__init__.py
./usr/local/lib/python2.7/dist-packages/django/views/generic/base.py
./usr/local/lib/python2.7/dist-packages/django/views/generic/dates.py

So it installs by default to /usr/local/lib/python2.7/dist-packages - this is the same behavior FPM uses.

I think the bug, if any, is that maybe the install bin path should respect python's default, which appears to be /usr/local/bin on my system:

% tar -ztf dist/Django-1.5.1.linux-x86_64.tar.gz | grep bin/django-admin.py
./usr/local/lib/python2.7/dist-packages/django/bin/django-admin.py
./usr/local/lib/python2.7/dist-packages/django/bin/django-admin.pyc
./usr/local/bin/django-admin.py

If I remove the default value in fpm for python's install bin, it installs to /usr/local/bin

% bin/fpm -fs python -t deb Django
% dpkg -c python-django_1.5.1_all.deb  | grep django-admin
-rwxrwxr-x jls/jls         124 2013-07-02 09:33 ./usr/local/bin/django-admin.py

As for the default install location for the lib stuff, this is chosen by python and it's configuration. On ubuntu, I find /usr/lib/python2.7/sysconfig.py describes the install locations "posix_local" in the _INSTALL_SCHEMES dict. Beyond that, I haven't looked.

If you desire a different prefix for installation, fpm tries to provide this with the --prefix flag:

% fpm -fs python -t deb --prefix /pants Django
 % dpkg -c python-django_1.5.1_all.deb
...
-rw-r--r-- jls/jls        4994 2013-03-09 06:37 ./pants/data/django/conf/locale/lb/LC_MESSAGES/django.mo
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/data/django/conf/locale/sl/
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/data/django/conf/locale/sl/LC_MESSAGES/
...
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/lib/
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/lib/django/
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/lib/django/conf/
-rw-rw-r-- jls/jls       21863 2013-03-28 13:07 ./pants/lib/django/conf/global_settings.py
-rw-rw-r-- jls/jls        8770 2013-07-02 09:41 ./pants/lib/django/conf/__init__.pyc
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/lib/django/conf/locale/
...
drwxrwxr-x jls/jls           0 2013-07-02 09:41 ./pants/bin/
-rwxrwxr-x jls/jls         124 2013-07-02 09:41 ./pants/bin/django-admin.py

Does this help?

I'm happy to remove the default bin path of /usr/bin and let python choose. I think perhaps it was a bug that fpm had a default value that was different from python's and I can't find any evidence in the commit logs to show that it was intentional.

@r4um

This comment has been minimized.

Contributor

r4um commented Jul 29, 2013

related #415

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Jul 29, 2013

I think this is fixed now; fpm no longer has an explicit default for the python scripts path, so however python is configured will determine the real default location.

vStone added a commit to vStone/fpm that referenced this issue May 2, 2014

vStone added a commit to vStone/fpm that referenced this issue May 2, 2014

vStone added a commit to vStone/fpm that referenced this issue May 2, 2014

vStone added a commit to vStone/fpm that referenced this issue May 2, 2014

Merged pull request: jordansissel#694: Fixes 2 python issues within t…
…he tests

See jordansissel#694 for more information

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

vStone added a commit to vStone/fpm that referenced this issue May 6, 2014

Merged pull request: jordansissel#694: Fixes 2 python issues within t…
…he tests

See jordansissel#694 for more information

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

vStone added a commit to vStone/fpm that referenced this issue May 6, 2014

Merged pull request: jordansissel#694: Fixes 2 python issues within t…
…he tests

See jordansissel#694 for more information

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

vStone added a commit to vStone/fpm that referenced this issue Jun 10, 2014

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

Merged pull request: jordansissel#694: Fixes 2 python issues within t…
…he tests

See jordansissel#694 for more information

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

vStone added a commit to vStone/fpm that referenced this issue Jun 11, 2014

Merged pull request: #jordansissel#694: Fixes 2 python issues within …
…the tests

See jordansissel#694 for more information

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

vStone added a commit to vStone/fpm that referenced this issue Sep 18, 2014

Merged pull request: jordansissel#694: Fixes 2 python issues within t…
…he tests

* pr/694:
  Since jordansissel#480, no default path is set so we should define one for testing python
  Fixes python tests where python 3.x is installed

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 18, 2014

prof-milki pushed a commit to prof-milki/xpm that referenced this issue Dec 27, 2014

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