Matthew Palmer <mpal...@debian.org> writes:

> So someone's using a single file as both a library and a stand-alone
> program. Damned silly idea.

Not so silly; a Python module can be useful both as a main program and
as a re-useable component in other programs. The well-known Python idiom
of testing ‘if __name__ == '__main__'’ is commonly used to make a module
that can be used in either way.

> Stick zynjacku.py in a proper library path somewhere, and write a
> little shim wrapper to stick in /usr/bin that calls zynjacku as it
> expects to be called.

Yes, that's one way to do it, and quite valid. It does, though, involve
creating that shim separately after installing the distribution.

IIUC, the ‘entry_points’ facility (of the third-party ‘pkg_resources’
module) is another way, that allows the program file to be created
automatically, such that when run it will invoke a specified function,
along with the rest of the distribution's installation process.

-- 
 \                         “I'm a great lover, I'll bet.” —Emo Philips |
  `\                                                                   |
_o__)                                                                  |
Ben Finney


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to