bodhi-backend: try and convert owner-sync-pagure to python3
Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
parent
acd6c2a194
commit
f3872807e0
1 changed files with 10 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python3
|
||||||
"""
|
"""
|
||||||
This script updates the packageList ownership in Koji based on repo ownership
|
This script updates the packageList ownership in Koji based on repo ownership
|
||||||
in Pagure.
|
in Pagure.
|
||||||
|
@ -13,12 +13,12 @@ This is heavily based on "owner-sync-pkgdb.j2" which was introduced in commit
|
||||||
# /usr/local/bin/owner-sync-pkgdb dist-5E-epel
|
# /usr/local/bin/owner-sync-pkgdb dist-5E-epel
|
||||||
# /usr/local/bin/owner-sync-pkgdb dist-6E-epel
|
# /usr/local/bin/owner-sync-pkgdb dist-6E-epel
|
||||||
# /usr/local/bin/owner-sync-pkgdb epel7
|
# /usr/local/bin/owner-sync-pkgdb epel7
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import ConfigParser
|
import configparser
|
||||||
from urlparse import urljoin
|
from urllib.parse import urljoin
|
||||||
import multiprocessing.pool
|
import multiprocessing.pool
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
@ -106,14 +106,14 @@ def get_options():
|
||||||
for configFile in ('/etc/koji.conf', os.path.expanduser('~/.koji/config')):
|
for configFile in ('/etc/koji.conf', os.path.expanduser('~/.koji/config')):
|
||||||
if os.access(configFile, os.F_OK):
|
if os.access(configFile, os.F_OK):
|
||||||
f = open(configFile)
|
f = open(configFile)
|
||||||
config = ConfigParser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.readfp(f)
|
config.readfp(f)
|
||||||
f.close()
|
f.close()
|
||||||
if config.has_section('koji'):
|
if config.has_section('koji'):
|
||||||
for name, value in config.items('koji'):
|
for name, value in config.items('koji'):
|
||||||
if opts.has_key(name):
|
if name in opts:
|
||||||
opts[name] = value
|
opts[name] = value
|
||||||
for entry in opts.keys():
|
for entry in list(opts.keys()):
|
||||||
if entry == 'server' or entry == 'weburl':
|
if entry == 'server' or entry == 'weburl':
|
||||||
pass
|
pass
|
||||||
return opts
|
return opts
|
||||||
|
@ -276,7 +276,7 @@ def get_pagure_project_branches(namespace, package=None, verbose=False):
|
||||||
get_pagure_project_names_from_page, session, namespace,
|
get_pagure_project_names_from_page, session, namespace,
|
||||||
package=package, verbose=verbose)
|
package=package, verbose=verbose)
|
||||||
project_names_sets = pool.map(partial_get_pagure_project_names_from_page,
|
project_names_sets = pool.map(partial_get_pagure_project_names_from_page,
|
||||||
range(1, num_pages + 1))
|
list(range(1, num_pages + 1)))
|
||||||
|
|
||||||
if project_names_sets:
|
if project_names_sets:
|
||||||
# Combine all the project name sets
|
# Combine all the project name sets
|
||||||
|
@ -401,14 +401,14 @@ if __name__ == '__main__':
|
||||||
namespace_to_projects[namespace] = \
|
namespace_to_projects[namespace] = \
|
||||||
get_pagure_project_branches(namespace, package=package, verbose=verbose)
|
get_pagure_project_branches(namespace, package=package, verbose=verbose)
|
||||||
|
|
||||||
for tag, info in tag_info.items():
|
for tag, info in list(tag_info.items()):
|
||||||
if verbose:
|
if verbose:
|
||||||
print('Determining which projects have the namespace "{0}" and '
|
print('Determining which projects have the namespace "{0}" and '
|
||||||
'branch "{1}"'.format(namespace, tag))
|
'branch "{1}"'.format(namespace, tag))
|
||||||
namespaces = info['namespaces']
|
namespaces = info['namespaces']
|
||||||
pkgs = []
|
pkgs = []
|
||||||
for namespace in namespaces:
|
for namespace in namespaces:
|
||||||
for pkg, branches in namespace_to_projects[namespace].items():
|
for pkg, branches in list(namespace_to_projects[namespace].items()):
|
||||||
if info['branch'] in branches or tag == ('f' + RAWHIDE):
|
if info['branch'] in branches or tag == ('f' + RAWHIDE):
|
||||||
# The tag and branch names are the same for "old-style" branches
|
# The tag and branch names are the same for "old-style" branches
|
||||||
pkgs.append(pkg)
|
pkgs.append(pkg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue