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

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

zllak
Copy link
Contributor

@zllak 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:https://...../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 ! :)

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

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
Copy link
Contributor Author

zllak commented Mar 21, 2012

Great, thanks ! :)

@jordansissel
Copy link
Owner

fpm 0.4.3 is up!

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

@zllak
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants