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

Always expand the path for the setup.py file #180

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@zllak
Contributor

zllak commented Mar 21, 2012

As we chdir in the setup.py base directory, we need to be sure to have
an absolute path. If we have a relative path, after chdir in the base
dir, the command to get metadata will fail. And if we remove the chdir,
some setup.py file open "local" file (i.e README files). So, to be sure
that the command will run, after chdir, we need to use the absolute
path.

The bug can be reproduced when building a python package from a directory.
Download a package tarball from PyPI, extract the source, and in the same
directory, build using fpm:
wget http://...../celery-2.5.0.tar.gz
tar zxvf celery-2.5.0.tar.gz
fpm -s python -t deb celery-2.5.0

This was making fpm resolve the setup.py to "celery-2.5.0/setup.py", and then, chdir into celery-2.5.0 directory and running the command, which was looking for celery-2.5.0/setup.py, which fails.

If you have any comment ! :)

Always expand the path for the setup.py file
As we chdir in the setup.py base directory, we need to be sure to have
an absolute path. If we have a relative path, after chdir in the base
dir, the command to get metadata will fail. And if we remove the chdir,
some setup.py file open "local" file (i.e README files). So, to be sure
that the command will run, after chdir, we need to use the absolute
path.
@jordansissel

This comment has been minimized.

Owner

jordansissel commented Mar 21, 2012

This is a bug, what should be happening is:

  • chdir to the package dir ("celery-2.5.0" in this case)
  • python setup.py ...

Expanding the path shouldn't matter as it should always look at the local setup.py after chdir'ing. I'll take a peak.

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Mar 21, 2012

Confirmed:


seven(/tmp) % fpm -s python -t deb celery-2.5.1 
python: can't open file 'celery-2.5.1/setup.py': [Errno 2] No such file or directory
@zllak

This comment has been minimized.

Contributor

zllak commented Mar 21, 2012

In this case, the setup.py in the command must always be "setup.py", with no path ?
As it's meant to be chdir in the directory.
Nop ?

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Mar 21, 2012

inside fpm, yeah, it should chdir to the target directory, then run 'python setup.py ...' It's a bug in this case that it is not doing this.

@zllak

This comment has been minimized.

Contributor

zllak commented Mar 21, 2012

So I guess in load_package_info (python.rb) the setup_cmd variable must not use the setup_py variable, and directly use "setup.py" ?
Do you want me to fix it ?

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Mar 21, 2012

After the fix:

% ruby bin/fpm -s python -t deb tmp/celery-2.5.1

Created deb package {"path":"python-celery_2.5.1-1_all.deb"}
@zllak

This comment has been minimized.

Contributor

zllak commented Mar 21, 2012

Great, thanks ! :)

@jordansissel

This comment has been minimized.

Owner

jordansissel commented Mar 21, 2012

fpm 0.4.3 is up!

Thanks much for spending the energy to debug and provide a patch :)

@zllak

This comment has been minimized.

Contributor

zllak commented Mar 21, 2012

Thank you for maintaining such a great project !
fpm saves me from hours creating debian packages :)

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

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

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