I have a python script that I want to package for Debian. I use a debian/install file where I wrote

auto_dice.py /usr/bin/

Linitan then complains about the .py extension (script-with-language-extension).

I then changed it to

auto_dice.py /usr/bin/autodice.py

which causes an error because it interpreted autodice.py as a directory.

How can I do the rename there? I do not want to rename my python script in the sources.


From Debian bug 245554 already mentioned:

this can already be easily solved if you use dh >= 9 and dh-exec. Just make your .install file executable, add #!/usr/bin/dh-exec to the top, and you can use "source => dest", like this:

debian/default.conf => /etc/my-package/start.conf
  • This definitely is the best way. Not much to do really, just make sure you have dh-exec installed and then enter the list of files to be installed with a different name. Very easy! Dec 22 '21 at 4:16

You cannot rename files using dh_install (via the debian/install). You will need to rename it during the debian/rules "build" target before you get to the dh_install invocation.

  • so it will be build: \\ mv auto_dice.py autodice? Apr 5 '11 at 21:38
  • likely the mv would happen in the target directory rather than the build directory, but yeah, you'd have to add the move before calling dh_install.
    – Kees Cook
    Apr 7 '11 at 1:39
  • For a bug report requesting this feature, see bugs.debian.org/cgi-bin/bugreport.cgi?bug=245554 Mar 21 '12 at 19:39
  • @Kees Cook: if you rename it in the target directory - would apt-get still be able to remove the file after package removal/upgrading?
    – zerkms
    May 27 '13 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.