On Nov 22, 2010, at 10:54 AM, Piotr Ożarowski wrote: >I wanted to add flaskext/__init__.py file to python-flask binary package >yesterday and I realized it will require to add too many lines to my >tiny debian/rules file so... I implemented pyinstall feature in >dh_python2 instead (see debpython/tools.py file¹).
Is this because flaskext/ isn't actually a (Python) package that exists in the python-flask source? I'm not familiar with this code, but it looks like this is a package namespace being claimed for flask extensions. If so, in this specific case, why not just add a directory called flaskext and an empty flaskext/__init__.py to the source code (via a patch if not upstream)? Then it would just be a matter of adding 'flaskext' to the setup.py `packages` key. >If dh_python2 will find debian/pkg.pyinstall file, it will install files >from that file as public modules for all requested Python versions. > >Example lines and their debian/rules equivalents (assuming 2.5, >2.6 and 2.7 is in the list of supported Python versions and >X-Python-Version allows all of them): I started looking at using debian/pkg.install to handle a case that Scott mentioned to me w.r.t. the flufl.* packages. Because flufl is a namespace package, we were worried about how to handle the flufl/__init__.py file. Scott's suggestion was to create two binary packages in the flufl.i18n source package, the latter owning only flufl/__init__.py. I started to go down this path but realized, 1) it's actually kind of painful because it was difficult to figure out the build paths to create the file in; 2) it was unnecessary since AFAICT, dh_python2 handles namespace packages for you. >foo.py >====== >cp foo.py debian/pkg/usr/lib/python2.5/site-packages/ >cp foo.py debian/pkg/usr/lib/python2.6/dist-packages/ >cp foo.py debian/pkg/usr/lib/python2.7/dist-packages/ > >foo/bar.py 2.6- >=============== >cp foo/bar.py debian/pkg/usr/lib/python2.6/dist-packages/foo/ >cp foo/bar.py debian/pkg/usr/lib/python2.7/dist-packages/foo/ > >(Scott: I know, I know, I have to change version range syntax, I >will do it some day...) > >foo/bar.py spam >=============== >cp foo/bar.py debian/pkg/usr/lib/python2.6/site-packages/spam/ >cp foo/bar.py debian/pkg/usr/lib/python2.6/dist-packages/spam/ >cp foo/bar.py debian/pkg/usr/lib/python2.7/dist-packages/spam/ > >debian/foo.py >============= >cp debian/foo.py debian/pkg/usr/lib/python2.6/site-packages/ >cp debian/foo.py debian/pkg/usr/lib/python2.6/dist-packages/ >cp debian/foo.py debian/pkg/usr/lib/python2.7/dist-packages/ > >(note that debian dir is skipped, use "debian/foo.py debian" if you want >to use debian namespace) > >debian/*.py spam.egg 2.7 >======================== >cp debian/foo.py debian/pkg/usr/lib/python2.7/dist-packages/spam/egg/ >cp debian/bar.py debian/pkg/usr/lib/python2.7/dist-packages/spam/egg/ >cp debian/baz.py debian/pkg/usr/lib/python2.7/dist-packages/spam/egg/ I think this is pretty cool. I'd like to also see a syntax for path exclusion, so for example I could handle the namespace package case above (though I understand in dh_python2 that's not necessary). E.g. flufl -flufl/enum 2.6- Would say, install everything under flufl/ except for the path flufl/enum, on Python 2.6 and above. >What do you think? Is it worth adding also pkg.pyremove and pkg.pyrename >files? What other features would you like to see in dh_python2 or >dh_python3 (pyinstall doesn't make sense in dh_python3 as you can simply >use dh_install to install into /usr/lib/python3/dist-packages/)? > >PS anyone wants to help me document all these small features in >dh_python2 manpage? (I will rewrite it in RST and use rst2man, BTW) Awesome. Yes, I will help. I want to get back to my test+refactor branch anyway; I've been distracted on other things lately. >[¹] >http://alioth.debian.org/scm/loggerhead/pkg-python/python-defaults-debian/annotate/head:/debpython/tools.py -Barry
signature.asc
Description: PGP signature