Python 3 compatibility: use print as a function.

In Python 3 print is a function.

Change-Id: I97688f9946ce2d5e7a74b26d7b5b02e4a1595866
Story: 2003595
Task: 24916
This commit is contained in:
zhangyangyang 2018-08-30 13:37:45 +08:00
parent ed48913675
commit 4f874cb3c2
3 changed files with 69 additions and 69 deletions

View File

@ -165,7 +165,7 @@ def file_search(dir, pattern, recursive_depth=0):
for file in os.listdir(dir): for file in os.listdir(dir):
path = "%s/%s" % (dir, file) path = "%s/%s" % (dir, file)
if fnmatch.fnmatch(file, pattern): if fnmatch.fnmatch(file, pattern):
print path print(path)
match_list.append(path) match_list.append(path)
elif (recursive_depth > 0) and os.path.isdir(path): elif (recursive_depth > 0) and os.path.isdir(path):
sub_list = [] sub_list = []
@ -192,7 +192,7 @@ def get_repo_primary_data_list(rpm_type='RPM', arch_list=default_arch_list):
sub_list = file_search(d, 'repodata', 5) sub_list = file_search(d, 'repodata', 5)
rpm_repodata_roots.extend(sub_list) rpm_repodata_roots.extend(sub_list)
else: else:
print "invalid rpm_type '%s', valid types are %s" % (rpm_type, str(rpm_types)) print("invalid rpm_type '%s', valid types are %s" % (rpm_type, str(rpm_types)))
return repodata_list return repodata_list
for d in rpm_repodata_roots: for d in rpm_repodata_roots:
@ -262,7 +262,7 @@ def read_data_from_filelists_xml_gz(repodata_path, rpm_type='RPM', arch=default_
version=v.get('ver') version=v.get('ver')
release=v.get('rel') release=v.get('rel')
else: else:
print "%s: %s.%s has no 'filelists:version'" % (repodata_path, name, pkg_arch) print("%s: %s.%s has no 'filelists:version'" % (repodata_path, name, pkg_arch))
# print "%s %s %s %s " % (name, pkg_arch, version, release) # print "%s %s %s %s " % (name, pkg_arch, version, release)
@ -317,13 +317,13 @@ def read_data_from_primary_xml_gz(repodata_path, rpm_type='RPM', arch=default_ar
version=v.get('ver') version=v.get('ver')
release=v.get('rel') release=v.get('rel')
else: else:
print "%s: %s.%s has no 'root:version'" % (repodata_path, name, pkg_arch) print("%s: %s.%s has no 'root:version'" % (repodata_path, name, pkg_arch))
fn="%s-%s-%s.%s.rpm" % (name, version, release, arch) fn="%s-%s-%s.%s.rpm" % (name, version, release, arch)
pkg_data[rpm_type]['fn_to_name'][fn]=name pkg_data[rpm_type]['fn_to_name'][fn]=name
# SAL print "%s %s %s %s " % (name, pkg_arch, version, release) # SAL print "%s %s %s %s " % (name, pkg_arch, version, release)
print "%s %s %s %s " % (name, pkg_arch, version, release) print("%s %s %s %s " % (name, pkg_arch, version, release))
f=pkg.find('root:format', ns) f=pkg.find('root:format', ns)
if f is not None: if f is not None:
license=f.find('rpm:license', ns).text license=f.find('rpm:license', ns).text
@ -331,7 +331,7 @@ def read_data_from_primary_xml_gz(repodata_path, rpm_type='RPM', arch=default_ar
if sourcerpm != "": if sourcerpm != "":
pkg_data[rpm_type]['sourcerpm'][name] = sourcerpm pkg_data[rpm_type]['sourcerpm'][name] = sourcerpm
# SAL print "--- requires ---" # SAL print "--- requires ---"
print "--- requires ---" print("--- requires ---")
r=f.find('rpm:requires', ns) r=f.find('rpm:requires', ns)
if r is not None: if r is not None:
for rr in r.findall('rpm:entry', ns): for rr in r.findall('rpm:entry', ns):
@ -340,7 +340,7 @@ def read_data_from_primary_xml_gz(repodata_path, rpm_type='RPM', arch=default_ar
print " %s" % required_name print " %s" % required_name
pkg_data[rpm_type]['requires'][name].append(required_name) pkg_data[rpm_type]['requires'][name].append(required_name)
else: else:
print "%s: %s.%s has no 'rpm:requires'" % (repodata_path, name, pkg_arch) print("%s: %s.%s has no 'rpm:requires'" % (repodata_path, name, pkg_arch))
# print "--- provides ---" # print "--- provides ---"
p=f.find('rpm:provides', ns) p=f.find('rpm:provides', ns)
if p is not None: if p is not None:
@ -355,7 +355,7 @@ def read_data_from_primary_xml_gz(repodata_path, rpm_type='RPM', arch=default_ar
continue continue
pkg_data[rpm_type]['providers'][provided_name]=name pkg_data[rpm_type]['providers'][provided_name]=name
else: else:
print "%s: %s.%s has no 'rpm:provides'" % (repodata_path, name, pkg_arch) print("%s: %s.%s has no 'rpm:provides'" % (repodata_path, name, pkg_arch))
# print "--- files ---" # print "--- files ---"
for fn in f.findall('root:file', ns): for fn in f.findall('root:file', ns):
file_name=fn.text file_name=fn.text
@ -369,7 +369,7 @@ def read_data_from_primary_xml_gz(repodata_path, rpm_type='RPM', arch=default_ar
continue continue
pkg_data[rpm_type]['file_owners'][file_name]=name pkg_data[rpm_type]['file_owners'][file_name]=name
else: else:
print "%s: %s.%s has no 'root:format'" % (repodata_path, name, pkg_arch) print("%s: %s.%s has no 'root:format'" % (repodata_path, name, pkg_arch))
# print "%s %s %s %s %s" % (name, pkg_arch, version, release, license) # print "%s %s %s %s %s" % (name, pkg_arch, version, release, license)
infile.close infile.close
@ -379,13 +379,13 @@ def calulate_all_direct_requires_and_descendants(rpm_type='RPM'):
calulate_pkg_direct_requires_and_descendants(name, rpm_type=rpm_type) calulate_pkg_direct_requires_and_descendants(name, rpm_type=rpm_type)
def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'): def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'):
print "%s needs:" % name print("%s needs:" % name)
if not rpm_type in pkg_data: if not rpm_type in pkg_data:
print "Error: unknown rpm_type '%s'" % rpm_type print("Error: unknown rpm_type '%s'" % rpm_type)
return return
if not name in pkg_data[rpm_type]['requires']: if not name in pkg_data[rpm_type]['requires']:
print "Note: No requires data for '%s'" % name print("Note: No requires data for '%s'" % name)
return return
for req in pkg_data[rpm_type]['requires'][name]: for req in pkg_data[rpm_type]['requires'][name]:
@ -397,7 +397,7 @@ def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'):
pro = pkg_data[rpm_type]['file_owners'][req] pro = pkg_data[rpm_type]['file_owners'][req]
else: else:
pro = '???' pro = '???'
print "package %s has unresolved requirement '%s'" % (name, req) print("package %s has unresolved requirement '%s'" % (name, req))
else: else:
# i.e. rpm_type == 'SRPM' # i.e. rpm_type == 'SRPM'
rpm_pro = '???' rpm_pro = '???'
@ -407,7 +407,7 @@ def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'):
rpm_pro = pkg_data['RPM']['file_owners'][req] rpm_pro = pkg_data['RPM']['file_owners'][req]
else: else:
rpm_pro = '???' rpm_pro = '???'
print "package %s has unresolved requirement '%s'" % (name, req) print("package %s has unresolved requirement '%s'" % (name, req))
if rpm_pro is not None and rpm_pro != '???': if rpm_pro is not None and rpm_pro != '???':
if not name in pkg_data[rpm_type]['pkg_direct_requires_rpm']: if not name in pkg_data[rpm_type]['pkg_direct_requires_rpm']:
@ -421,10 +421,10 @@ def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'):
pro = pkg_data['SRPM']['fn_to_name'][fn] pro = pkg_data['SRPM']['fn_to_name'][fn]
else: else:
pro = '???' pro = '???'
print "package %s requires srpm file name %s" % (name,fn) print("package %s requires srpm file name %s" % (name,fn))
else: else:
pro = '???' pro = '???'
print "package %s requires rpm %s, but that rpm has no known srpm" % (name,rpm_pro) print("package %s requires rpm %s, but that rpm has no known srpm" % (name,rpm_pro))
if pro is not None and pro != '???': if pro is not None and pro != '???':
if not name in pkg_data[rpm_type]['pkg_direct_requires']: if not name in pkg_data[rpm_type]['pkg_direct_requires']:
@ -436,7 +436,7 @@ def calulate_pkg_direct_requires_and_descendants(name, rpm_type='RPM'):
if not name in pkg_data[rpm_type]['pkg_direct_descendants'][pro]: if not name in pkg_data[rpm_type]['pkg_direct_descendants'][pro]:
pkg_data[rpm_type]['pkg_direct_descendants'][pro].append(name) pkg_data[rpm_type]['pkg_direct_descendants'][pro].append(name)
print " %s -> %s" % (req, pro) print(" %s -> %s" % (req, pro))
@ -446,11 +446,11 @@ def calulate_all_transitive_requires(rpm_type='RPM'):
def calulate_pkg_transitive_requires(name, rpm_type='RPM'): def calulate_pkg_transitive_requires(name, rpm_type='RPM'):
if not rpm_type in pkg_data: if not rpm_type in pkg_data:
print "Error: unknown rpm_type '%s'" % rpm_type print("Error: unknown rpm_type '%s'" % rpm_type)
return return
if not name in pkg_data[rpm_type]['pkg_direct_requires']: if not name in pkg_data[rpm_type]['pkg_direct_requires']:
print "Note: No direct_requires data for '%s'" % name print("Note: No direct_requires data for '%s'" % name)
return return
pkg_data[rpm_type]['pkg_transitive_requires'][name]=[] pkg_data[rpm_type]['pkg_transitive_requires'][name]=[]
@ -482,7 +482,7 @@ def calulate_pkg_transitive_requires(name, rpm_type='RPM'):
if rpm_type == 'RPM': if rpm_type == 'RPM':
unresolved.append(r) unresolved.append(r)
else: else:
print "WARNING: calulate_pkg_transitive_requires: can't append rpm to SRPM list, name=%s, r=%s" % (name, r) print("WARNING: calulate_pkg_transitive_requires: can't append rpm to SRPM list, name=%s, r=%s" % (name, r))
# print "%s: add %s" % (name, r) # print "%s: add %s" % (name, r)
if rpm_type != 'RPM': if rpm_type != 'RPM':
for r in pkg_data[rpm_type]['pkg_transitive_requires_rpm'][name]: for r in pkg_data[rpm_type]['pkg_transitive_requires_rpm'][name]:
@ -492,9 +492,9 @@ def calulate_pkg_transitive_requires(name, rpm_type='RPM'):
s = pkg_data['SRPM']['fn_to_name'][fn] s = pkg_data['SRPM']['fn_to_name'][fn]
pkg_data[rpm_type]['pkg_transitive_requires'][name].append(s) pkg_data[rpm_type]['pkg_transitive_requires'][name].append(s)
else: else:
print "package %s requires srpm file name %s, but srpm name is not known" % (name, fn) print("package %s requires srpm file name %s, but srpm name is not known" % (name, fn))
else: else:
print "package %s requires rpm %s, but that rpm has no known srpm" % (name, r) print("package %s requires rpm %s, but that rpm has no known srpm" % (name, r))
def calulate_all_transitive_descendants(rpm_type='RPM'): def calulate_all_transitive_descendants(rpm_type='RPM'):
for name in pkg_data[rpm_type]['pkg_direct_descendants']: for name in pkg_data[rpm_type]['pkg_direct_descendants']:
@ -502,11 +502,11 @@ def calulate_all_transitive_descendants(rpm_type='RPM'):
def calulate_pkg_transitive_descendants(name, rpm_type='RPM'): def calulate_pkg_transitive_descendants(name, rpm_type='RPM'):
if not rpm_type in pkg_data: if not rpm_type in pkg_data:
print "Error: unknown rpm_type '%s'" % rpm_type print("Error: unknown rpm_type '%s'" % rpm_type)
return return
if not name in pkg_data[rpm_type]['pkg_direct_descendants']: if not name in pkg_data[rpm_type]['pkg_direct_descendants']:
print "Note: No direct_requires data for '%s'" % name print("Note: No direct_requires data for '%s'" % name)
return return
pkg_data[rpm_type]['pkg_transitive_descendants'][name]=[] pkg_data[rpm_type]['pkg_transitive_descendants'][name]=[]
@ -541,9 +541,9 @@ def create_dest_rpm_data():
def create_cache(cache_dir): def create_cache(cache_dir):
for rpm_type in rpm_types: for rpm_type in rpm_types:
print "" print("")
print "==== %s ====" % rpm_type print("==== %s ====" % rpm_type)
print "" print("")
rpm_repodata_primary_list = get_repo_primary_data_list(rpm_type=rpm_type, arch_list=default_arch_by_type[rpm_type]) rpm_repodata_primary_list = get_repo_primary_data_list(rpm_type=rpm_type, arch_list=default_arch_by_type[rpm_type])
for arch in default_arch_by_type[rpm_type]: for arch in default_arch_by_type[rpm_type]:
read_data_from_repodata_primary_list(rpm_repodata_primary_list, rpm_type=rpm_type, arch=arch) read_data_from_repodata_primary_list(rpm_repodata_primary_list, rpm_type=rpm_type, arch=arch)
@ -557,7 +557,7 @@ def create_cache(cache_dir):
cache_name="%s/%s-direct-requires" % (cache_dir, rpm_type) cache_name="%s/%s-direct-requires" % (cache_dir, rpm_type)
f=open(cache_name, "w") f=open(cache_name, "w")
for name in sorted(pkg_data[rpm_type]['pkg_direct_requires']): for name in sorted(pkg_data[rpm_type]['pkg_direct_requires']):
print "%s needs %s" % (name, pkg_data[rpm_type]['pkg_direct_requires'][name]) print("%s needs %s" % (name, pkg_data[rpm_type]['pkg_direct_requires'][name]))
f.write("%s;" % name) f.write("%s;" % name)
first=True first=True
for req in sorted(pkg_data[rpm_type]['pkg_direct_requires'][name]): for req in sorted(pkg_data[rpm_type]['pkg_direct_requires'][name]):
@ -572,7 +572,7 @@ def create_cache(cache_dir):
cache_name="%s/%s-direct-descendants" % (cache_dir, rpm_type) cache_name="%s/%s-direct-descendants" % (cache_dir, rpm_type)
f=open(cache_name, "w") f=open(cache_name, "w")
for name in sorted(pkg_data[rpm_type]['pkg_direct_descendants']): for name in sorted(pkg_data[rpm_type]['pkg_direct_descendants']):
print "%s informs %s" % (name, pkg_data[rpm_type]['pkg_direct_descendants'][name]) print("%s informs %s" % (name, pkg_data[rpm_type]['pkg_direct_descendants'][name]))
f.write("%s;" % name) f.write("%s;" % name)
first=True first=True
for req in sorted(pkg_data[rpm_type]['pkg_direct_descendants'][name]): for req in sorted(pkg_data[rpm_type]['pkg_direct_descendants'][name]):
@ -616,7 +616,7 @@ def create_cache(cache_dir):
cache_name="%s/%s-direct-requires-rpm" % (cache_dir, rpm_type) cache_name="%s/%s-direct-requires-rpm" % (cache_dir, rpm_type)
f=open(cache_name, "w") f=open(cache_name, "w")
for name in sorted(pkg_data[rpm_type]['pkg_direct_requires_rpm']): for name in sorted(pkg_data[rpm_type]['pkg_direct_requires_rpm']):
print "%s needs rpm %s" % (name, pkg_data[rpm_type]['pkg_direct_requires_rpm'][name]) print("%s needs rpm %s" % (name, pkg_data[rpm_type]['pkg_direct_requires_rpm'][name]))
f.write("%s;" % name) f.write("%s;" % name)
first=True first=True
for req in sorted(pkg_data[rpm_type]['pkg_direct_requires_rpm'][name]): for req in sorted(pkg_data[rpm_type]['pkg_direct_requires_rpm'][name]):
@ -672,9 +672,9 @@ def create_cache(cache_dir):
def test(): def test():
for rpm_type in rpm_types: for rpm_type in rpm_types:
print "" print("")
print "==== %s ====" % rpm_type print("==== %s ====" % rpm_type)
print "" print("")
rpm_repodata_primary_list = get_repo_primary_data_list(rpm_type=rpm_type, arch_list=default_arch_by_type[rpm_type]) rpm_repodata_primary_list = get_repo_primary_data_list(rpm_type=rpm_type, arch_list=default_arch_by_type[rpm_type])
for arch in default_arch_by_type[rpm_type]: for arch in default_arch_by_type[rpm_type]:
read_data_from_repodata_primary_list(rpm_repodata_primary_list, rpm_type=rpm_type, arch=arch) read_data_from_repodata_primary_list(rpm_repodata_primary_list, rpm_type=rpm_type, arch=arch)
@ -686,21 +686,21 @@ def test():
calulate_all_transitive_descendants(rpm_type=rpm_type) calulate_all_transitive_descendants(rpm_type=rpm_type)
for name in pkg_data[rpm_type]['pkg_direct_requires']: for name in pkg_data[rpm_type]['pkg_direct_requires']:
print "%s needs %s" % (name, pkg_data[rpm_type]['pkg_direct_requires'][name]) print("%s needs %s" % (name, pkg_data[rpm_type]['pkg_direct_requires'][name]))
for name in pkg_data[rpm_type]['pkg_direct_descendants']: for name in pkg_data[rpm_type]['pkg_direct_descendants']:
print "%s informs %s" % (name, pkg_data[rpm_type]['pkg_direct_descendants'][name]) print("%s informs %s" % (name, pkg_data[rpm_type]['pkg_direct_descendants'][name]))
for name in pkg_data[rpm_type]['pkg_transitive_requires']: for name in pkg_data[rpm_type]['pkg_transitive_requires']:
print "%s needs %s" % (name, pkg_data[rpm_type]['pkg_transitive_requires'][name]) print("%s needs %s" % (name, pkg_data[rpm_type]['pkg_transitive_requires'][name]))
print "" print("")
for name in pkg_data[rpm_type]['pkg_transitive_descendants']: for name in pkg_data[rpm_type]['pkg_transitive_descendants']:
print "%s informs %s" % (name, pkg_data[rpm_type]['pkg_transitive_descendants'][name]) print("%s informs %s" % (name, pkg_data[rpm_type]['pkg_transitive_descendants'][name]))
print "" print("")
if os.path.isdir(publish_cache_dir): if os.path.isdir(publish_cache_dir):
create_cache(publish_cache_dir) create_cache(publish_cache_dir)
else: else:
print "ERROR: Directory not found '%s" % publish_cache_dir print("ERROR: Directory not found '%s" % publish_cache_dir)

View File

@ -139,13 +139,13 @@ class IPReport(object):
if filename.endswith('rpm'): if filename.endswith('rpm'):
self.built_binaries.append(filename) self.built_binaries.append(filename)
print ('Looking up packages for which we have source...') print('Looking up packages for which we have source...')
self.original_src_pkgs = dict() self.original_src_pkgs = dict()
self.build_original_src_pkgs() self.build_original_src_pkgs()
print ('Looking up packages we built...') print('Looking up packages we built...')
self.built_src_pkgs = dict() self.built_src_pkgs = dict()
self.build_built_src_pkgs() self.build_built_src_pkgs()
print ('Looking up packages we built...') print('Looking up packages we built...')
self.hardcoded_lookup_dict = dict() self.hardcoded_lookup_dict = dict()
self.build_hardcoded_lookup_dict() self.build_hardcoded_lookup_dict()
@ -180,17 +180,17 @@ class IPReport(object):
if 'MY_WORKSPACE' in os.environ: if 'MY_WORKSPACE' in os.environ:
self.workspace = os.environ['MY_WORKSPACE'] self.workspace = os.environ['MY_WORKSPACE']
else: else:
print 'Could not find $MY_WORKSPACE' print('Could not find $MY_WORKSPACE')
raise IOError('Could not fine $MY_WORKSPACE') raise IOError('Could not fine $MY_WORKSPACE')
if 'MY_REPO' in os.environ: if 'MY_REPO' in os.environ:
self.repo = os.environ['MY_REPO'] self.repo = os.environ['MY_REPO']
else: else:
print 'Could not find $MY_REPO' print('Could not find $MY_REPO')
raise IOError('Could not fine $MY_REPO') raise IOError('Could not fine $MY_REPO')
def do_bin_pkgs(self): def do_bin_pkgs(self):
print ('Gathering binary package information') print('Gathering binary package information')
self.read_bin_pkgs() self.read_bin_pkgs()
def read_bin_pkgs(self): def read_bin_pkgs(self):
@ -268,7 +268,7 @@ class IPReport(object):
src_pkg.desc, 'Runtime', src_pkg.shipped_as, modified_string, 'No', src_pkg.licences, src_pkg.desc, 'Runtime', src_pkg.shipped_as, modified_string, 'No', src_pkg.licences,
src_pkg.origin, kmod_string, src_pkg.notes]) src_pkg.origin, kmod_string, src_pkg.notes])
if 'unknown' in src_pkg.origin.lower(): if 'unknown' in src_pkg.origin.lower():
print ( print(
'Warning: Could not determine origin of ' + src_pkg.name + '. Please investigate/populate manually') 'Warning: Could not determine origin of ' + src_pkg.name + '. Please investigate/populate manually')
def bin_to_src(self): def bin_to_src(self):
@ -289,19 +289,19 @@ class IPReport(object):
if 'shim-signed' in bin_pkg.source: if 'shim-signed' in bin_pkg.source:
for tmp in self.built_src_pkgs: for tmp in self.built_src_pkgs:
if 'shim-signed' in tmp: if 'shim-signed' in tmp:
print ('shim-signed hack -- ' + bin_pkg.source + ' to ' + tmp) print('shim-signed hack -- ' + bin_pkg.source + ' to ' + tmp)
bin_pkg.source = tmp bin_pkg.source = tmp
break break
if 'shim-unsigned' in bin_pkg.source: if 'shim-unsigned' in bin_pkg.source:
for tmp in self.built_src_pkgs: for tmp in self.built_src_pkgs:
if 'shim-0' in tmp: if 'shim-0' in tmp:
print ('shim-unsigned hack -- ' + bin_pkg.source + ' to ' + tmp) print('shim-unsigned hack -- ' + bin_pkg.source + ' to ' + tmp)
bin_pkg.source = tmp bin_pkg.source = tmp
break break
if 'grub2-efi-pxeboot' in bin_pkg.source: if 'grub2-efi-pxeboot' in bin_pkg.source:
for tmp in self.built_src_pkgs: for tmp in self.built_src_pkgs:
if 'grub2-2' in tmp: if 'grub2-2' in tmp:
print ('grub2-efi-pxeboot hack -- ' + bin_pkg.source + ' to ' + tmp) print('grub2-efi-pxeboot hack -- ' + bin_pkg.source + ' to ' + tmp)
bin_pkg.source = tmp bin_pkg.source = tmp
break break
@ -464,26 +464,26 @@ def main(argv):
for opt, arg in opts: for opt, arg in opts:
if opt in ('-h', '--help'): if opt in ('-h', '--help'):
print 'usage:' print('usage:')
print ' ip_report.py [options]' print(' ip_report.py [options]')
print ' Creates and IP report in $MY_WORKSPACE/export/ip_report ' print(' Creates and IP report in $MY_WORKSPACE/export/ip_report ')
print ' Source RPMs (both Wind River and non WR) are placed in subdirs within that path' print(' Source RPMs (both Wind River and non WR) are placed in subdirs within that path')
print '' print('')
print 'Options:' print('Options:')
print ' -h/--help - this help' print(' -h/--help - this help')
print ' -d <file>/--delta=<file> - create "notes" field, comparing report with a previous report' print(' -d <file>/--delta=<file> - create "notes" field, comparing report with a previous report')
print ' -n/--no-copy - do not copy files into subdirs (this is faster, but means you' print(' -n/--no-copy - do not copy files into subdirs (this is faster, but means you')
print ' don\'t get SHA sums for files)' print(' don\'t get SHA sums for files)')
print ' -w <path>/--workspace=<path> - use the specified path as workspace, instead of $MY_WORKSPACE' print(' -w <path>/--workspace=<path> - use the specified path as workspace, instead of $MY_WORKSPACE')
print ' -r <path>/--repo=<path> - use the specified path as repo, instead of $MY_REPO' print(' -r <path>/--repo=<path> - use the specified path as repo, instead of $MY_REPO')
print ' -o <path>/--output=<path> - output to specified path (instead of $MY_WORKSPACE/export/ip_report)' print(' -o <path>/--output=<path> - output to specified path (instead of $MY_WORKSPACE/export/ip_report)')
print ' -s/--strip - strip (remove) unchanged files if copied' print(' -s/--strip - strip (remove) unchanged files if copied')
exit() exit()
elif opt in ('-d', '--delta'): elif opt in ('-d', '--delta'):
delta_file = os.path.normpath(arg) delta_file = os.path.normpath(arg)
delta_file = os.path.expanduser(delta_file) delta_file = os.path.expanduser(delta_file)
if not os.path.exists(delta_file): if not os.path.exists(delta_file):
print 'Cannot locate ' + delta_file print('Cannot locate ' + delta_file)
exit(1) exit(1)
elif opt in ('-w', '--workspace'): elif opt in ('-w', '--workspace'):
workspace = os.path.normpath(arg) workspace = os.path.normpath(arg)
@ -499,11 +499,11 @@ def main(argv):
elif opt in ('-s', '--strip-unchanged'): elif opt in ('-s', '--strip-unchanged'):
strip_unchanged = True strip_unchanged = True
print ('Doing IP report') print('Doing IP report')
if delta_file is not None: if delta_file is not None:
print 'Delta from ' + delta_file print('Delta from ' + delta_file)
else: else:
print 'No delta specified' print('No delta specified')
ip_report = IPReport(workspace=workspace, repo=repo) ip_report = IPReport(workspace=workspace, repo=repo)
ip_report.do_bin_pkgs() ip_report.do_bin_pkgs()

View File

@ -6,4 +6,4 @@ FN=sys.argv[1]
variables={} variables={}
variables['config_opts']={} variables['config_opts']={}
execfile( FN, variables ) execfile( FN, variables )
print variables['config_opts']['yum.conf'] print(variables['config_opts']['yum.conf'])