FS#30024 - [hplip] uses wrong python interpreter

Attached to Project: Arch Linux
Opened by Thomas Schneider (BlackLotus) - Saturday, 26 May 2012, 10:18 GMT
Last edited by Andreas Radke (AndyRTR) - Saturday, 02 June 2012, 21:08 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tom Gundersen (tomegun)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
hplip is a toolset to handle hp printers written in python2.
Some tools of this suite aren't modified so they use python2.

Additional info:
hplip 3.12.4-1

Steps to reproduce:

[micha@myhost ~]$ /usr/share/hplip/upgrade.py
File "/usr/share/hplip/upgrade.py", line 117
except getopt.GetoptError, e:
^
SyntaxError: invalid syntax

Steps to fix:
sudo sed -i 's/python/env python2/' /usr/share/hplip/upgrade.py

[micha@myhost ~]$ /usr/share/hplip/upgrade.py

HP Linux Imaging and Printing System (ver. 3.12.4)
HPLIP upgrade latest version ver. 1.0

Copyright (c) 2001-14 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

Latest version of HPLIP is already installed.
[micha@myhost ~]$

PKGBUILD patch included.
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Saturday, 02 June 2012, 21:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  fixed in 3.12.4-4; I doubt we need to fix all python calls inside base/magic.py. That shouldn't harm funcionality.
Comment by solsTiCe (zebul666) - Thursday, 31 May 2012, 09:03 GMT
why is the switch from python to python2 is not made on ALL python script ???

this is done on other package with this simple line:
find -name *.py -exec sed -i "s|/usr/bin/python|/usr/bin/python2|" {} \;
and/or
find -name *.py -exec sed -i "s|/usr/bin/env python|/usr/bin/env python2|" {} \;

you don't have to bother to create a sed line for each file
Comment by Eckhart Arnold (ecki) - Saturday, 02 June 2012, 07:36 GMT
Good idea, however, the file hplip/base/magic.py does contain "/usr/bin/python" also in other places, e.g. line 254 and following:

[0L, 'string', '=', '#!/usr/bin/python', 'application/x-python'],

this would be replaced, too, by the find-name ... sed command. not sure if this is intended.

Loading...