diff options
author | 2017-03-21 00:02:14 +0200 | |
---|---|---|
committer | 2017-03-21 00:17:13 +0200 | |
commit | 7e556e101024f201267b16e5120e9b76e62cdec9 (patch) | |
tree | 54d5271c4d2712f4b0880b9a71aaef35ba6fbaf3 | |
parent | gnome: Use UTC date for generation date note in output (diff) | |
download | gentoo-bumpchecker-7e556e101024f201267b16e5120e9b76e62cdec9.tar.gz gentoo-bumpchecker-7e556e101024f201267b16e5120e9b76e62cdec9.tar.bz2 gentoo-bumpchecker-7e556e101024f201267b16e5120e9b76e62cdec9.zip |
gnome: Quick port to python3
Just what's necessary to get it going on python3 (just print changes and some bytes vs
str error) for now.
-rwxr-xr-x | gnome-bumpchecker.py | 2 | ||||
-rw-r--r-- | modules/ftp_module.py | 10 | ||||
-rw-r--r-- | modules/gnome_module.py | 20 | ||||
-rw-r--r-- | modules/gnome_output.py | 4 | ||||
-rw-r--r-- | modules/package_module.py | 10 | ||||
-rw-r--r-- | modules/portage_module.py | 10 |
6 files changed, 28 insertions, 28 deletions
diff --git a/gnome-bumpchecker.py b/gnome-bumpchecker.py index c9656e9..c9f6e55 100755 --- a/gnome-bumpchecker.py +++ b/gnome-bumpchecker.py @@ -1,4 +1,4 @@ -#! /usr/bin/python2 +#!/usr/bin/env python3 # Copyright John N. Laliberte <allanonjl@gentoo.org> # Copyright Daniel Gryniewicz <dang@gentoo.org> # LICENSE - GPL2 diff --git a/modules/ftp_module.py b/modules/ftp_module.py index 837624c..f3c5ea9 100644 --- a/modules/ftp_module.py +++ b/modules/ftp_module.py @@ -14,16 +14,16 @@ DEBUG = False class FTPWalker: def __init__(self, site, user, passwd): self.ftp = ftplib.FTP(site, user, passwd) - if DEBUG: print "logged into ftp" + if DEBUG: print("logged into ftp") def cd(self, path): try: self.ftp.cwd(path) #sys.stdout.write(".") - if DEBUG: print "successfully changed path to " + path + if DEBUG: print("successfully changed path to " + path) return True except: - print "Directory does not exist " + path + print("Directory does not exist " + path) return False def pwd(self): @@ -46,7 +46,7 @@ class FTPWalker: name, symbolic = name.split("->") name = name.strip() symbolic = symbolic.strip() - if DEBUG: print "Name of the file is: " + name + if DEBUG: print("Name of the file is: " + name) return FileInformation(name, isdir) @@ -88,7 +88,7 @@ def find_files(walker, dir, excluded_names, excluded_suffixes): for fileinfo in listSiteGen(walker, dir, excluded_names): #if not excluded( excluded_suffixes, fileinfo): - if DEBUG: print "Appending: " + str(fileinfo.name) + if DEBUG: print("Appending: " + str(fileinfo.name)) file_listing.append(fileinfo.name) return file_listing diff --git a/modules/gnome_module.py b/modules/gnome_module.py index 06fe6d8..afba235 100644 --- a/modules/gnome_module.py +++ b/modules/gnome_module.py @@ -44,8 +44,8 @@ class GNOME: raise ValueError("Couldn't open %s" % url) ret = [] - for line in data.iter_lines(): - components = str.strip(line).split(':') + for line in data.text.splitlines(): + components = line.strip().split(':') # Skip invalid lines if len(components) != 4 or len(components[2]) == 0: continue @@ -56,7 +56,7 @@ class GNOME: if (pkg.name and pkg.version): ret.append(pkg) else: - print "Warning: Ignoring package %s because parsing of its name or version string '%s' failed" % (components[1], components[2]) + print("Warning: Ignoring package %s because parsing of its name or version string '%s' failed" % (components[1], components[2])) return ret def generate_data_individual(self, release_packages): @@ -114,7 +114,7 @@ def compare_packages(release_packages, latest_packages, packages_in_portage): release_package = package latest_package = portage_module.findpackage(package.name, latest_packages) if latest_package == None: - print "Warning: latest packages set does not have an entry for %s, using release set version %s." % (package.name, package.version) + print("Warning: latest packages set does not have an entry for %s, using release set version %s." % (package.name, package.version)) latest_package = package portage_package = portage_module.findpackage(package.name, packages_in_portage) @@ -139,15 +139,15 @@ def compare_packages(release_packages, latest_packages, packages_in_portage): # FIXME: Reports release version as latest version to not have to deal with this right now if latest_package == None: - print "No latest version known for %s, FIXME!" % release_package.name + print("No latest version known for %s, FIXME!" % release_package.name) latest_package = release_package if DEBUG: - print "package: " + str(release_package.name) + \ - " | pp: " + str(portage_package.version) + \ - " | rp: " + str(release_package.version) + \ - " | lp: " + str(latest_package.version) + \ - " | status: " + str(status) + print("package: " + str(release_package.name) + + " | pp: " + str(portage_package.version) + + " | rp: " + str(release_package.version) + + " | lp: " + str(latest_package.version) + + " | status: " + str(status)) status_packages.append(package_module.PackageStatus(release_package.name, str(portage_package.version), str(release_package.version), str(latest_package.version), status)) diff --git a/modules/gnome_output.py b/modules/gnome_output.py index f127e6a..19b6da0 100644 --- a/modules/gnome_output.py +++ b/modules/gnome_output.py @@ -101,7 +101,7 @@ class Output: self.write_file(lines, clioptions_module.Options().get_arguments().output) - print "Generated html output." + print("Generated html output.") def generate_keywords(self): lines = [] @@ -115,7 +115,7 @@ class Output: self.write_file(lines, "package.keywords") - print "Generate package.keywords output." + print("Generate package.keywords output.") def write_file(self, lines, filename): file = open(filename, "w") diff --git a/modules/package_module.py b/modules/package_module.py index b663c28..e10e835 100644 --- a/modules/package_module.py +++ b/modules/package_module.py @@ -75,16 +75,16 @@ class Package(object): self.raw_name = self.name self.major_minor = self.parse_mm(self.version) # else: -# print "Error, " + raw_string + " is not a valid package!" +# print("Error, " + raw_string + " is not a valid package!") def parse_mm(self, version): return '.'.join(version.split('.')[0:2]) def print_info(self): - print "Name: " + str(self.name) - print "Version: " + str(self.package_version) - print "Name+Version: " + str(self.name_plus_version) - print "Raw: " + str(self.raw_string) + print("Name: " + str(self.name)) + print("Version: " + str(self.package_version)) + print("Name+Version: " + str(self.name_plus_version)) + print("Raw: " + str(self.raw_string)) def __repr__(self): return self.name_plus_version diff --git a/modules/portage_module.py b/modules/portage_module.py index 7aac61f..47e37c2 100644 --- a/modules/portage_module.py +++ b/modules/portage_module.py @@ -115,8 +115,8 @@ def find_packages_in_tree(package_list, portdir=None, all_overlays=False, overla return portage_versions def tests(): - print split_package_into_parts("media-gfx/gimp-3.5.0-r3") - print split_package_into_parts("media-gfx/gimp-3.5") - print find_category("gimp") - print find_category("gimp-2.0") - print best_version(["gimp-2.0", "gimp-2.0-r1", "gimp-3.0"]) + print(split_package_into_parts("media-gfx/gimp-3.5.0-r3")) + print(split_package_into_parts("media-gfx/gimp-3.5")) + print(find_category("gimp")) + print(find_category("gimp-2.0")) + print(best_version(["gimp-2.0", "gimp-2.0-r1", "gimp-3.0"])) |