[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Binary-only data packages



Simon Richter <Simon.Richter@phobos.fachschaften.tu-muenchen.de> writes:

> I'd like to write an automatic dependency generator for Python scripts (so
> that you can write "Depends: {pythonlibs:Depends}" into your control file
> and have it replaced by the packages you need to satisfy all imports by
> the Python scripts in debian/<package>. For this, you'd need a database of
> which Module is in which package.

[...]

It seems to me that what you're proposing is much more complicated
than is actually needed.

It's fairly straightforward to determine all the modules directly
imported by providing a custom __import__ in the __builtins__ passed
to execfile().  To get the packages containing these modules, you can
just replace any trailing .pyc by .py on each module's __file__
attribute, and call 'dpkg -S' with the resulting list.

For example, if a script imports just sys and Tkinter, only Tkinter
has a filename for the module, /usr/lib/python2.0/lib-tk/Tkinter.pyc.
Passing this to dpkg gives:

% dpkg -S /usr/lib/python2.0/lib-tk/Tkinter.py
python2-tk

This does require that all the packages required by the script be
installed, which I think is a reasonable assumption.  This doesn't
help with build dependencies, though.

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	    "Quiet, you'll miss the humorous conclusion."



Reply to: