0001-python3-replace-file-function-by-open-41132.patch
tests/robot/WcsRobotFrameworkLibrary.py | ||
---|---|---|
95 | 95 |
else: |
96 | 96 |
return |
97 | 97 | |
98 | 98 |
wcs_command = [WCSCTL, 'start', |
99 | 99 |
'--app-dir', '/tmp/.tests/', |
100 | 100 |
'--data-dir', WCS_DATA_DIR, |
101 | 101 |
'--port', str(self.port), '--http', '--silent'] |
102 | 102 |
sp = subprocess.Popen(wcs_command) |
103 |
fd = file('/tmp/.tests/pid', 'w')
|
|
103 |
fd = open('/tmp/.tests/pid', 'w')
|
|
104 | 104 |
fd.write(str(sp.pid)) |
105 | 105 |
fd.close() |
106 | 106 | |
107 | 107 |
# Wait for the daemons to load themselves |
108 | 108 |
starttime = time.time() |
109 | 109 |
self._waitforport(starttime) |
110 | 110 | |
111 | 111 |
def stop_wcs_server(self): |
112 | 112 |
if not os.path.exists('/tmp/.tests/pid'): |
113 | 113 |
return |
114 |
fd = file('/tmp/.tests/pid')
|
|
114 |
fd = open('/tmp/.tests/pid')
|
|
115 | 115 |
pid = int(fd.read()) |
116 | 116 |
fd.close() |
117 | 117 |
try: |
118 | 118 |
# valgrind seems to prefer SIGINT to SIGTERM |
119 | 119 |
os.kill(pid, signal.SIGINT) |
120 | 120 |
except OSError, e: |
121 | 121 |
print >> sys.stderr, 'failed to kill pid %s (%s)' % (pid, e) |
122 | 122 |
wcs/ctl/hobo_notify.py | ||
---|---|---|
56 | 56 |
self.process_notification(notification, pub) |
57 | 57 | |
58 | 58 |
@classmethod |
59 | 59 |
def load_notification(cls, args): |
60 | 60 |
if args[0] == '-': |
61 | 61 |
# get environment definition from stdin |
62 | 62 |
return json.load(sys.stdin) |
63 | 63 |
else: |
64 |
return json.load(file(args[0]))
|
|
64 |
return json.load(open(args[0]))
|
|
65 | 65 | |
66 | 66 |
@classmethod |
67 | 67 |
def check_valid_notification(cls, notification): |
68 | 68 |
return isinstance(notification, dict) \ |
69 | 69 |
and notification['@type'] in ['provision', 'deprovision'] \ |
70 | 70 |
and 'objects' in notification \ |
71 | 71 |
and 'audience' in notification \ |
72 | 72 |
and isinstance(notification['audience'], list) \ |
wcs/qommon/static/images/categories/generate.py | ||
---|---|---|
40 | 40 |
parser = OptionParser() |
41 | 41 |
parser.add_option('-c', '--colour', dest='colour', metavar='COLOUR') |
42 | 42 |
(options, args) = parser.parse_args() |
43 | 43 | |
44 | 44 |
for icon_id, icon_name in mapping.items(): |
45 | 45 |
svg_path = 'src/icon_%s/' % icon_id |
46 | 46 |
svg_path = os.path.join(svg_path, [x for x in os.listdir(svg_path) if x.endswith('.svg')][0]) |
47 | 47 |
if options.colour: |
48 |
tree = ET.fromstring(file(svg_path).read().replace('#000000', '#%s' % options.colour))
|
|
48 |
tree = ET.fromstring(open(svg_path).read().replace('#000000', '#%s' % options.colour))
|
|
49 | 49 |
for elem in tree.findall('*'): |
50 | 50 |
if not elem.attrib.get('style'): |
51 | 51 |
elem.attrib['style'] = 'fill:#%s' % options.colour |
52 | 52 |
else: |
53 |
tree = ET.fromstring(file(svg_path).read())
|
|
53 |
tree = ET.fromstring(open(svg_path).read())
|
|
54 | 54 | |
55 | 55 |
author = None |
56 | 56 |
for elem in tree: |
57 | 57 |
if elem.tag == '{http://www.w3.org/2000/svg}text' and elem.text.startswith('Created by'): |
58 | 58 |
author = elem.text[len('Created by')+1:] |
59 | 59 |
tree.remove(elem) |
60 | 60 |
for elem in tree: |
61 | 61 |
if elem.tag == '{http://www.w3.org/2000/svg}text' and 'Noun Project' in elem.text: |
62 |
- |