Bug 27848 - Python 2.6 Fehlermeldung
Python 2.6 Fehlermeldung
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: univention-lib
UCS 3.0
Other Linux
: P5 normal (vote)
: UCS 3.0-2
Assigned To: Florian Best
Lukas Walter
: interim-3
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-06 15:47 CEST by Stefan Gohmann
Modified: 2012-07-20 15:24 CEST (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2012-07-06 15:47:31 CEST
Trigger für python-support werden verarbeitet ...
Compiling /usr/lib/pymodules/python2.4/univention/lib/share_restrictions.py ...
  File "/usr/lib/pymodules/python2.4/univention/lib/share_restrictions.py", line 187
    with file("/etc/cups/printers.conf") as fd:
            ^
SyntaxError: invalid syntax

/usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py:187: Warning: 'with' will become a reserved keyword in Python 2.6
Compiling /usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py ...
  File "/usr/lib/pymodules/python2.5/univention/lib/share_restrictions.py", line 187
    with file("/etc/cups/printers.conf") as fd:
            ^
SyntaxError: invalid syntax


Der Python2.6 spezifische Code sollte entfernt werden.
Comment 1 Alexander Kläser univentionstaff 2012-07-06 16:15:45 CEST
Das betrifft nur einzelne Pakete (univention-lib, python-univention), die ggf. schon vorab über das preup-Skript bei einem Update installiert werden.
Comment 2 Janek Walkenhorst univentionstaff 2012-07-09 12:55:28 CEST
Auch im UDM durch errata48:

/usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will become a reserved keyword in Python 2.6
Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ...
  File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257
    except TypeError as e:
                      ^
SyntaxError: invalid syntax
Comment 3 Alexander Kläser univentionstaff 2012-07-09 15:24:50 CEST
(In reply to comment #2)
> Auch im UDM durch errata48:
> 
> /usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will
> become a reserved keyword in Python 2.6
> Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ...
>   File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257
>     except TypeError as e:
>                       ^
> SyntaxError: invalid syntax
Comment 4 Alexander Kläser univentionstaff 2012-07-11 12:03:37 CEST
(In reply to comment #2)
> Auch im UDM durch errata48:
> 
> /usr/lib/pymodules/python2.5/univention/admin/uldap.py:257: Warning: 'as' will
> become a reserved keyword in Python 2.6
> Compiling /usr/lib/pymodules/python2.5/univention/admin/uldap.py ...
>   File "/usr/lib/pymodules/python2.5/univention/admin/uldap.py", line 257
>     except TypeError as e:
>                       ^
> SyntaxError: invalid syntax

→ Das wurde bereits in revision 33575 angepasst.
Comment 5 Florian Best univentionstaff 2012-07-11 15:11:29 CEST
Der python2.6 spezifische code wurde durch 2.4 validen code ersetzt.

Macht es in diesem Fall nicht Sinn, dieses script aus dem univention-lib Ordner rauszuwerfen und in univention-samba einzufügen?
Momentan wird das Script nur in univention-lib reinkopiert ist aber kein Bestandteil von univention-lib.

 univention-samba (6.0.41-2) unstable; urgency=low
 .
   * backport to python2.4 valid code in share_restrictions.py (Bug #27848)
Comment 6 Alexander Kläser univentionstaff 2012-07-12 14:42:54 CEST
Bitte noch einmal überprüfen:

try:
    fd = file(...)
    ...
finally:
    fd.close()

Wenn während open() schon eine Excpetion auftritt, kann close() nicht aufgerufen werden, daher ist es besser folgendes zu verwenden:

fd = file(...)
try:
    ...
finally:
    fd.close()

Damit wird die Datei geschlossen, wenn Exception in dem Try-Block auftreten.
Comment 7 Florian Best univentionstaff 2012-07-12 14:51:28 CEST
Änderungen gemacht.
univention-samba (6.0.44-1) unstable; urgency=low
  * try/finally fixes (Bug #27848)
Comment 8 Lukas Walter univentionstaff 2012-07-13 11:08:36 CEST
Code sieht jetzt gut aus.

Changelog passt,
Verified.
Comment 9 Stefan Gohmann univentionstaff 2012-07-20 15:24:13 CEST
UCS 3.0-2 has been released: 
  http://forum.univention.de/viewtopic.php?f=54&t=1905

If this error occurs again, please use "Clone This Bug".