Enhancements to Python's distutils

Prevent the creation of empty omf/* folder

Reported by Emilien Klein on 2011-02-07
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-distutils-extra
Undecided
Unassigned

Bug Description

I've set up a project called Nautilus Image Manipulator [1], using Quickly [2]. By default the setup.py script uses DistUtilsExtra.auto to install the program.

When running debuild to generate a Debian package, lintian (quality control for Debian packages) complains about the creation of an empty directory "usr/share/omf/nautilus-image-manipulator/". This is the actual output of Lintian:

$ lintian -i -I --show-overrides nautilus-image-manipulator_0.2-1_i386.changes
I: nautilus-image-manipulator: package-contains-empty-directory usr/share/omf/nautilus-image-manipulator/
N:
N: This package installs an empty directory. This might be intentional but
N: it's normally a mistake. If it is intentional, add a lintian override.
N:
N: If a package ships with or installs empty directories, you can remove
N: them in debian/rules by calling:
N:
N: $ find path/to/base/dir -type d -empty -delete
N:
N: Severity: wishlist, Certainty: possible
N:

Looking at the output of debuild, I noticed that the usr/share/omf/nautilus-image-manipulator/ folder gets created by the setup script (it is not included in the source tarball).
Looking on the Internet, I found this discussion [3] possibly linking DistUtilsExtra with this empty folder creation. I went digging through the code of DistUtilsExtra and think that I have located the origin of this problem in build_help.get_data_files() located in DistUtilsExtra/command/build_help.py:

data_files is initialized empty ( = []), then there is a for loop that would add files (but in my case no eligible files are encountered, so "data_files" stays empty), and at the end the following line appends to the "empty" structure:

data_files.append((os.path.join('share', 'omf', name), glob(omf_pattern)))

I believe this should be preceded by a "if" condition, so that this only gets appended if data_files is not empty.
Is my analysis wrong? Is there a good reason to be creating this empty directory if there is no "omf" file (whatever these files are supposed to be...)?

Thanks for looking into that.

[1] https://launchpad.net/nautilus-image-manipulator
[2] https://launchpad.net/quickly
[3] https://code.launchpad.net/~pwlars/abrek/packaging/+merge/33050

Emilien Klein (emilien-klein) wrote :

Has this also been fixed by r241 [0] committed by Martin Pitt? The part about adding omf files is now conditional. I believe this bug can be closed.

[0] http://bazaar.launchpad.net/~python-distutils-extra-hackers/python-distutils-extra/debian/revision/241

Martin Pitt (pitti) wrote :

Indeed r241 fixed this as a by-product.

Changed in python-distutils-extra:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers