Hello, I just subscribed yesterday, having being redirected here from the python-tutor ML. I hope this is the right place to ask the question I am struggling with. I am trying to package a program I wrote for debian. It's my **very first time** with packaging at all, and also with distutils, so I followed online documentation to get something done. It work-ish'ed, but I am struggling with a problem on dependencies. To write my setup.py script I followed this: http://packages.python.org/distribute/setuptools.html#automatic-script-creat... In the section on dependencies it says: "If your project depends on packages that aren’t registered in PyPI, you may still be able to depend on them, as long as they are available for download as an egg, in the standard distutils sdist format, or as a single .py file. You just need to add some URLs to the dependency_links argument to setup()." My question is: how do I list dpendencies that are not python code? For example: say my program needs to launch at some point another program like for example inkscape, is there a way to specify this in the setup.py file, or am I out of luck and my only chance is to list it in the debian directory half-way through the process of converting my code to a .deb package? Also, another question out of scientific curiosity. On a debian-based distro, if a python module is installed via PyPI, will it be "seen" and handled by apt-get / synaptic as if it were installed from a .deb package? In other words: would a user be able to execute `apt-get remove xxxx` if xxxx has been installed with python easy_install xxxx`? Thank you in advance for your help! /mac
Hello Mac, Op 19-08-11 15:43, Mac Ryan schreef:
Hello,
I just subscribed yesterday, having being redirected here from the python-tutor ML. I hope this is the right place to ask the question I am struggling with.
I am trying to package a program I wrote for debian. It's my **very first time** with packaging at all, and also with distutils, so I followed online documentation to get something done. It work-ish'ed, but I am struggling with a problem on dependencies.
To write my setup.py script I followed this: http://packages.python.org/distribute/setuptools.html#automatic-script-creat...
In the section on dependencies it says: "If your project depends on packages that aren’t registered in PyPI, you may still be able to depend on them, as long as they are available for download as an egg, in the standard distutils sdist format, or as a single .py file. You just need to add some URLs to the dependency_links argument to setup()."
My question is: how do I list dpendencies that are not python code? For example: say my program needs to launch at some point another program like for example inkscape, is there a way to specify this in the setup.py file, or am I out of luck and my only chance is to list it in the debian directory half-way through the process of converting my code to a .deb package?
The text you find is still talking about python packages. It means: when you depend on python packages that are not registered on PyPI, you can use the dependency_links argument. It will not work for inkscape. As an example, when I need some ldap integration then in my setup.py I can list python-ldap as a dependency. This python package will then be installed. But that python-ldap package itself will fail to install when you do not have the necessary ldap bindings installed on your OS (it would fail in the compile step then, hopefully with a clear error message). There is no way that I know for the python-ldap package to declare such an OS-dependency.
Also, another question out of scientific curiosity. On a debian-based distro, if a python module is installed via PyPI, will it be "seen" and handled by apt-get / synaptic as if it were installed from a .deb package? In other words: would a user be able to execute `apt-get remove xxxx` if xxxx has been installed with python easy_install xxxx`?
No, sorry, that won't work. The two are completely separate.
Thank you in advance for your help! /mac
You're welcome. Cheers, -- Maurits van Rees Web App Programmer at Zest Software: http://zestsoftware.nl Personal website: http://maurits.vanrees.org/
Hello, thanks also to the feedback of this ML members, I manage to get going with debian packages using distutils + setuptools + stdeb. There are a few things that still puzzle me though on the data_files parameter of the setup script. The need for a MANIFEST.in file ------------------------------- Apparently including the list of files in `data_files` is not sufficient for them to be included in the distribution. I found this question on StackOverflow: http://stackoverflow.com/q/2994396/146792 and the accepted answer states that it was a bug fixed in python 2.7. (most probably this one: http://bugs.python.org/issue2279). Although I am running ubuntu 11.04 (shipping python 2.7.1+) the behaviour for me is still the old, possibly buggy one. What am I doing wrong? Data files for modules (instead than for packages) -------------------------------------------------- The small application I am testing my packaging skills with, has a file structure like this: . ├── distribute_setup.py ├── MANIFEST.in ├── setup.py └── src ├── prog.py ├── scrapedata.py └── data.yml In my distribution I only want to ship `prog.py` and `data.yml`, ignoring `scrapedata.py`. Initially I managed to build the .deb package by creating an `__init__.py` file in the `src` directory and then putting in my setup.py something like: packages = find_packages(), package_data = {'src': ['data.yml'], but then I realised that doing so I was creating a `src` directory under `/usr/lib/python2.7/dist-packages`, which seems very wrong (src is just a directory for me to keep my files organised, it is not a package). So I tried to do something like: py_modules = ['src/prog'], data_files=['', ['src/data.yml']], but - beside not working (see following question) - I wonder if there is a standard and better way to link data files to specific modules rather than packages. The dreadful "error: can't copy '': doesn't exist or not a regular file" ------------------------------------------------------------------------ This actually happens when I try to assemble the built distribution for debian (so it the problem might be with stdeb rather than with distutils, but I'm unsure). In my setup script I have: data_files=['', ['src/data.yml']], If I alter the destination directory with for example '.', the error message will be the same, just reporting the '.' instead of the '' (this is why I am sure it is related to this line)... Again, I am a bit confused... am I doing something wrong here? Thank you in advance for your help (and sorry if I am asking something silly. This is my very first experience with distutils and packaging! :) /mac
On Fri, Aug 19, 2011 at 10:11 AM, Maurits van Rees <m.van.rees@zestsoftware.nl> wrote:
Hello Mac,
Op 19-08-11 15:43, Mac Ryan schreef:
Also, another question out of scientific curiosity. On a debian-based distro, if a python module is installed via PyPI, will it be "seen" and handled by apt-get / synaptic as if it were installed from a .deb package? In other words: would a user be able to execute `apt-get remove xxxx` if xxxx has been installed with python easy_install xxxx`?
No, sorry, that won't work. The two are completely separate.
If you are interested in packaging for debian, lookup "stdeb" on PyPI. It will allow you to generate .deb packages which can be installed and handled by apt-get/synaptic. -- Ernesto Posse Modelling and Analysis in Software Engineering School of Computing Queen's University - Kingston, Ontario, Canada
On Mon, 22 Aug 2011 15:03:50 -0400 Ernesto Posse <eposse@gmail.com> wrote:
If you are interested in packaging for debian, lookup "stdeb" on PyPI. It will allow you to generate .deb packages which can be installed and handled by apt-get/synaptic.
Thank you Ernesto, just wondering if the other message that I sent to earlier today to the ML arrived, as I was in fact speaking of a possible bug in stdeb... /mac
On 22-08-11 22:42, Mac Ryan wrote:
Thank you Ernesto, just wondering if the other message that I sent to earlier today to the ML arrived, as I was in fact speaking of a possible bug in stdeb...
I've seen that one, so it arrived just fine on the list. Reinout -- Reinout van Rees http://reinout.vanrees.org/ reinout@vanrees.org http://www.nelen-schuurmans.nl/ "If you're not sure what to do, make something. -- Paul Graham"
participants (4)
-
Ernesto Posse
-
Mac Ryan
-
Maurits van Rees
-
Reinout van Rees