mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-07 21:58:41 +02:00
python3 compatibility: print function
The most visible change in python3 - removal of print statement and all the crufty print >> sys.stderr, foo, The from __future__ import print_function makes it available in python 2.6
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@@ -171,7 +173,7 @@ class Ar:
|
||||
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name))
|
||||
except EnvironmentError as e:
|
||||
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
|
||||
print >>sys.stderr, 'cannot use mmap to read the file, falling back to the default io'
|
||||
print('cannot use mmap to read the file, falling back to the default io', file=sys.stderr)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import tarfile
|
||||
@@ -153,12 +156,12 @@ if __name__ == '__main__':
|
||||
try:
|
||||
archq = ArchQuery.query(sys.argv[1])
|
||||
except ArchError as e:
|
||||
print e.msg
|
||||
print(e.msg)
|
||||
sys.exit(2)
|
||||
print archq.name(), archq.version(), archq.release(), archq.arch()
|
||||
print archq.canonname()
|
||||
print archq.description()
|
||||
print '##########'
|
||||
print '\n'.join(archq.provides())
|
||||
print '##########'
|
||||
print '\n'.join(archq.requires())
|
||||
print(archq.name(), archq.version(), archq.release(), archq.arch())
|
||||
print(archq.canonname())
|
||||
print(archq.description())
|
||||
print('##########')
|
||||
print('\n'.join(archq.provides()))
|
||||
print('##########')
|
||||
print('\n'.join(archq.requires()))
|
||||
|
@@ -13,6 +13,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import mmap
|
||||
import os
|
||||
import stat
|
||||
@@ -152,7 +154,7 @@ class CpioRead:
|
||||
self.__file = mmap.mmap(self.__file.fileno(), os.path.getsize(self.__file.name))
|
||||
except EnvironmentError as e:
|
||||
if e.errno == 19 or ( hasattr(e, 'winerror') and e.winerror == 5 ):
|
||||
print >>sys.stderr, 'cannot use mmap to read the file, failing back to default'
|
||||
print('cannot use mmap to read the file, failing back to default', file=sys.stderr)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from . import ar
|
||||
import os.path
|
||||
import re
|
||||
@@ -168,11 +171,11 @@ if __name__ == '__main__':
|
||||
try:
|
||||
debq = DebQuery.query(sys.argv[1])
|
||||
except DebError as e:
|
||||
print e.msg
|
||||
print(e.msg)
|
||||
sys.exit(2)
|
||||
print debq.name(), debq.version(), debq.release(), debq.arch()
|
||||
print debq.description()
|
||||
print '##########'
|
||||
print '\n'.join(debq.provides())
|
||||
print '##########'
|
||||
print '\n'.join(debq.requires())
|
||||
print(debq.name(), debq.version(), debq.release(), debq.arch())
|
||||
print(debq.description())
|
||||
print('##########')
|
||||
print('\n'.join(debq.provides()))
|
||||
print('##########')
|
||||
print('\n'.join(debq.requires()))
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
class PackageError(Exception):
|
||||
"""base class for all package related errors"""
|
||||
def __init__(self, fname, msg):
|
||||
@@ -115,13 +118,13 @@ if __name__ == '__main__':
|
||||
try:
|
||||
pkgq = PackageQuery.query(sys.argv[1])
|
||||
except PackageError as e:
|
||||
print e.msg
|
||||
print(e.msg)
|
||||
sys.exit(2)
|
||||
print pkgq.name()
|
||||
print pkgq.version()
|
||||
print pkgq.release()
|
||||
print pkgq.description()
|
||||
print '##########'
|
||||
print '\n'.join(pkgq.provides())
|
||||
print '##########'
|
||||
print '\n'.join(pkgq.requires())
|
||||
print(pkgq.name())
|
||||
print(pkgq.version())
|
||||
print(pkgq.release())
|
||||
print(pkgq.description())
|
||||
print('##########')
|
||||
print('\n'.join(pkgq.provides()))
|
||||
print('##########')
|
||||
print('\n'.join(pkgq.requires()))
|
||||
|
@@ -1,3 +1,6 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
@@ -313,12 +316,12 @@ if __name__ == '__main__':
|
||||
try:
|
||||
rpmq = RpmQuery.query(sys.argv[1])
|
||||
except RpmError as e:
|
||||
print e.msg
|
||||
print(e.msg)
|
||||
sys.exit(2)
|
||||
print rpmq.name(), rpmq.version(), rpmq.release(), rpmq.arch(), rpmq.url()
|
||||
print rpmq.summary()
|
||||
print rpmq.description()
|
||||
print '##########'
|
||||
print '\n'.join(rpmq.provides())
|
||||
print '##########'
|
||||
print '\n'.join(rpmq.requires())
|
||||
print(rpmq.name(), rpmq.version(), rpmq.release(), rpmq.arch(), rpmq.url())
|
||||
print(rpmq.summary())
|
||||
print(rpmq.description())
|
||||
print('##########')
|
||||
print('\n'.join(rpmq.provides()))
|
||||
print('##########')
|
||||
print('\n'.join(rpmq.requires()))
|
||||
|
Reference in New Issue
Block a user