Skip to content

Commit aa20736

Browse files
Revert "Switch to python3"
This reverts commit a9e9f6e. Change-Id: Ia96b6060e4d06b8bc96899bab76f83f8b74e364f
1 parent a9e9f6e commit aa20736

17 files changed

+32
-34
lines changed

tools/compare_distro_files.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2018 Red Hat
44
#

tools/compare_pip_and_rpm_repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2018 Red Hat
44
#

tools/get_package_lists.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2018 Red Hat
44
#

wait_for_other_jobs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
#
44
# Copyright (C) 2016 Red Hat, Inc

zuul_discover_tag_branch.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#
@@ -52,10 +52,9 @@ def main(self, args):
5252
else:
5353
self.log.info("Choosing '%s'" % valid_branch[0])
5454
print(valid_branch[0])
55-
except Exception:
55+
except:
5656
self.log.error("Couldn't find branch for tag %s" % tag)
5757
exit(1)
5858

59-
6059
if __name__ == "__main__":
6160
ZuulDiscoverTagBranch()

zuul_format_patch.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2019 Red Hat
44
#
@@ -144,7 +144,7 @@ def solve_conflict(change):
144144
git("cherry-pick FETCH_HEAD")
145145
except RuntimeError:
146146
if not solve_conflict(change):
147-
input("Fix cherry-pick and press enter to continue...: ")
147+
raw_input("Fix cherry-pick and press enter to continue...: ")
148148
change["filename"] = git(
149149
"format-patch -1 %s" % patches["paths"], read=True).strip()
150150
print("<= patch is %s" % change["filename"])

zuul_koji_compare_tag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#

zuul_koji_lib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#

zuul_koji_mash.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#

zuul_koji_populate_target.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#

zuul_koji_set_target.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#

zuul_koji_sign_release.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#
@@ -65,7 +65,7 @@ def retrieve_pkgs_to_sign(self):
6565

6666
def write_nvr_list_to_sign(self):
6767
self.to_sign_txt = os.path.join(self.td, 'to_sign.txt')
68-
fd = open(self.to_sign_txt, 'w')
68+
fd = file(self.to_sign_txt, 'w')
6969
for i in self.to_sign:
7070
pkg = re.sub('.el7.*$', '.el7', i)
7171
fd.write("%s\n" % pkg)
@@ -92,6 +92,5 @@ def main(self, args):
9292
koji write-signed-rpm 1c3bae4b $nvr;
9393
done""" % self.to_sign_txt)
9494

95-
9695
if __name__ == "__main__":
9796
ZuulKojiSignRelease()

zuul_rpm_build.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2016 Red Hat
44
#
@@ -138,7 +138,7 @@ def build_srpm(self, distgit, source_version=None):
138138

139139
def check_postinstall_failed(self, project):
140140
pattern = "^WARNING .* Failed install built packages$"
141-
rootlog = open(os.path.join(self.args.local_output, 'root.log')).read()
141+
rootlog = file(os.path.join(self.args.local_output, 'root.log')).read()
142142
if re.findall(pattern, rootlog, re.MULTILINE):
143143
raise RuntimeError("%s: built packages failed to be installed" %
144144
project)
@@ -186,7 +186,7 @@ def create_mock_config(self):
186186
rendered = self.render_mock_template()
187187
if not os.path.isdir(os.path.dirname(mockconf)):
188188
os.mkdir(os.path.dirname(mockconf))
189-
open(mockconf, 'w').write(rendered)
189+
file(mockconf, 'w').write(rendered)
190190

191191
def get_package_info(self, project, fallback=None):
192192
package_info = [pi for pi in self.distro_info['packages']

zuul_rpm_publish.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#
@@ -79,7 +79,7 @@ def main(self, args):
7979
srpms = glob.glob("zuul-rpm-build/*.src.rpm")
8080
else:
8181
srpms = self.get_srpms(args.testing_repo)
82-
srpms = filter(lambda x: re.match(r"^%s-\d.*" % package_name, x),
82+
srpms = filter(lambda x: re.match("^%s-\d.*" % package_name, x),
8383
srpms)
8484

8585
if len(srpms) != 1:
@@ -99,8 +99,8 @@ def main(self, args):
9999
# If the build task was unable to build the pkg for other reason
100100
# that a "Build already exists" error then the following task will
101101
# fail too.
102-
print("Build failed but if it was because of NVR already built")
103-
print("then try to add it to the tag.")
102+
print "Build failed but if it was because of NVR already built"
103+
print "then try to add it to the tag."
104104
self.execute(["koji", "--authtype=ssl", "tag-build",
105105
self.distro_info["koji-target"],
106106
srpm.replace('.src.rpm', '')])

zuul_rpm_setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#
@@ -32,7 +32,7 @@ def write_repo(self, of, conf):
3232
conf["repourl"] = "mirrorlist=%s" % conf["mirror"]
3333
elif "baseurl" in conf:
3434
conf["repourl"] = "baseurl=%s" % conf["baseurl"]
35-
print(conf)
35+
print conf
3636
of.write("""[%(name)s]
3737
name=%(name)s
3838
%(repourl)s
@@ -48,7 +48,7 @@ def check_repo(self, url):
4848
request.get_method = lambda: 'HEAD'
4949
response = urllib2.urlopen(request)
5050
return response.info().getheader('Content-Length') > 0
51-
except Exception:
51+
except:
5252
return False
5353

5454
def main(self, args):

zuul_set_distro_branch.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2017 Red Hat
44
#
@@ -34,7 +34,7 @@ def usage(self):
3434
def clone_config_repo(self, base_dir, git_server):
3535
dirname = "%s/%s" % (base_dir, 'config')
3636
if not os.path.isdir(os.path.dirname(dirname)):
37-
os.mkdir(os.path.dirname(dirname), 0o700)
37+
os.mkdir(os.path.dirname(dirname), 0700)
3838
repourl = "%s/config" % git_server
3939
if not os.path.isdir(dirname):
4040
self.log.info("Cloning %s to %s" % (repourl, dirname))
@@ -100,7 +100,7 @@ def update_repo_def(self, resources, raw_resources, name, branch, bfrom):
100100
def main(self, args):
101101
base_dir = os.path.expanduser(args.local_git_dir)
102102
if not os.path.isdir(base_dir):
103-
os.mkdir(base_dir, 0o700)
103+
os.mkdir(base_dir, 0700)
104104
# Get repos list to act on
105105
packages = self.distro_info["packages"]
106106
bfrom = self.distro_info.get("from", "master")
@@ -119,16 +119,16 @@ def main(self, args):
119119
self.clone_config_repo(base_dir, args.git_server)
120120
p_resources_path = os.path.join(
121121
base_dir, 'config', 'resources', args.project_resources)
122-
raw_resources = open(p_resources_path).readlines()
123-
resources = yaml.safe_load(open(p_resources_path))
122+
raw_resources = file(p_resources_path).readlines()
123+
resources = yaml.load(file(p_resources_path))
124124
for name in repos_names:
125125
self.update_repo_def(
126126
resources,
127127
raw_resources,
128128
name,
129129
branch,
130130
bfrom)
131-
open(p_resources_path, 'w').write("\n".join(raw_resources))
131+
file(p_resources_path, 'w').writelines(raw_resources)
132132

133133

134134
if __name__ == "__main__":

zuul_update_spec.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/env python3
1+
#!/bin/env python
22
#
33
# Copyright 2019 Red Hat
44
#

0 commit comments

Comments
 (0)