Removing *.py ending from python script filenames
Hello Vincent, Mark, Ben, Karl, Jens,
I just prepared packaging for fio-2.17 and as I added some of the new Python script I again came across the issues the file name ending "*.py" creates within Debian.
1) As per Debian policy files in /usr/bin or /usr/sbin or any of the other bin directory may not have such a file ending. Thus I may not put the files in $PATH.
2) Man or the manpage integration debhelper script do not like this file ending either:
[…]/usr/share/doc/fio> dpkg -L fio | grep man
[…]/usr/share/man/py/usr/share/man/py/man1/usr/share/man/py/man1/fiologparser_hist.1.gz
(the section here is complete crap)
And… well all ways to rename files *just* prior to the packaging run… are as far as I know… quite ugly – like preparing modified upstream tarball and things like that.
Now I wonder whether you would be okay with just removing the "*.py" filename ending from the script and manpage filenames.
[…]fio-upstream> find -iname "*.py*" | grep -v unit_tests ./tools/fio_latency2csv.py ./tools/fiologparser.py ./tools/hist/fiologparser_hist.py ./tools/hist/fiologparser_hist.py.1 ./tools/hist/half-bins.py
This would be the easiest solution for me as a packager, would allow to put scripts into $PATH and I think the "*.py" doesn´t really add much value. Actually the user of such a script can still see whether its a python script by looking at the file.
Also for putting things in $PATH it might make sense to add "fio" to the scriptname "half-bins.py" maybe "fio-half-bins.py".
I could prepare an upstream patch for that one… if you are okay with the name change.
And PS: Any intention to write some manpages for the scripts where they are missing? :)
Thank you,
Signature · 14 lines
Martin Steigerwald | Trainer teamix GmbH Südwestpark 43 90449 Nürnberg Tel.: +49 911 30999 55 | Fax: +49 911 30999 99 mail: [email protected] | web: http://www.teamix.de | blog: http://blog.teamix.de Amtsgericht Nürnberg, HRB 18320 | Geschäftsführer: Oliver Kügow, Richard Müller, Jakob Høholdt teamix Support Hotline: +49 911 30999-112 *** Bitte liken Sie uns auf Facebook: facebook.com/teamix ***
Hi,
just subscribed here for other reasons and stumbled across this, but since I know about Python packaging:
The "right way" (in as, understood and common to the Python community) to distribute Python scripts that are supposed to be installed and run from command line is to first package up the Python stuff as a proper Python package and then follow
For example
https://github.com/crossbario/crossbar/blob/master/setup.py#L98
This will install a proper wrapper with no extension. It will also allow to use the Python stuff from Python by mere importing the wrapped function.
(cpy3_1) oberstet@thinkpad-t430s:~/scm/crossbario/crossbario-organize$ which crossbar /home/oberstet/python/cpy3_1/bin/crossbar
(cpy3_1) oberstet@thinkpad-t430s:~/scm/crossbario/crossbario-organize$ cat which crossbar #!/home/oberstet/python/cpy3_1/bin/python3
# EASY-INSTALL-ENTRY-SCRIPT: 'crossbar','console_scripts','crossbar' __requires__ = 'crossbar'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('crossbar', 'console_scripts', 'crossbar')()
)(cpy3_1) oberstet@thinkpad-t430s:~/scm/crossbario/crossbario-organize$
Cheers,
/Tobias
PS: Also, please consider publishing the Python package to PyPI too (eg for people that find distro packages annoying, eg because they use virtualenv or what)
Quoted 8 lines · Martin Steigerwald
Hello Vincent, Mark, Ben, Karl, Jens,
I just prepared packaging for fio-2.17 and as I added some of the new Python script I again came across the issues the file name ending "*.py" creates within Debian.
...
Martin, my ultimate intention is to provide a fio patch to eliminate the need for fio_latency2csv.py.
The script translates latency data in fio's json+ output from the internal data structure that fio uses into more easily understandable latency bins and counts. I plan to prepare a patch that changes the json+ output format to directly provide the human readable latency data which will eliminate the need for the script.
I have no objection to any of your suggested changes.
Vincent
--
Vincent Fu
Software Dev Engr II
SanDisk, a Western Digital brand
Email: [email protected]
Office: 801 987 7079
________________________________
PLEASE NOTE: The information contained in this electronic mail message is intended only for the use of the designated recipient(s) named above. If the reader of this message is not the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify the sender by telephone or e-mail (as shown above) immediately and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).
Am Montag, 23. Januar 2017, 14:47:31 CET schrieb Vincent Fu:
Quoted 11 lines · Martin Steigerwald
Quoted 7 lines
Hello Vincent, Mark, Ben, Karl, Jens,
I just prepared packaging for fio-2.17 and as I added some of the new Python script I again came across the issues the file name ending "*.py" creates within Debian.
...
Martin, my ultimate intention is to provide a fio patch to eliminate the need for
fio_latency2csv.py.
Okay, thank you.
Well for Debian Stretch I will settle with fio 2.16, so there is time… I may keep the current solution as is – i.e. stuffing it all into /usr/share/doc/fio – especially as you plan to implement the script functionality into fio.
Thanks,
Signature · 14 lines
Martin Steigerwald | Trainer teamix GmbH Südwestpark 43 90449 Nürnberg Tel.: +49 911 30999 55 | Fax: +49 911 30999 99 mail: [email protected] | web: http://www.teamix.de | blog: http://blog.teamix.de Amtsgericht Nürnberg, HRB 18320 | Geschäftsführer: Oliver Kügow, Richard Müller, Jakob Høholdt teamix Support Hotline: +49 911 30999-112 *** Bitte liken Sie uns auf Facebook: facebook.com/teamix ***