24 |
else: |
else: |
25 |
yield line |
yield line |
26 |
|
|
27 |
|
def call_editor(filename): |
28 |
|
"""Return a sequence of possible editor binaries for the current platform""" |
29 |
|
|
30 |
|
editors = [] |
31 |
|
|
32 |
|
for varname in 'VISUAL', 'EDITOR': |
33 |
|
if varname in os.environ: |
34 |
|
editors.append(os.environ[varname]) |
35 |
|
|
36 |
|
editors.extend(('/usr/bin/editor', 'vi', 'pico', 'nano', 'joe')) |
37 |
|
|
38 |
|
for editor in editors: |
39 |
|
try: |
40 |
|
ret = subprocess.call([editor, filename]) |
41 |
|
except OSError, e: |
42 |
|
if e.errno == 2: |
43 |
|
continue |
44 |
|
raise |
45 |
|
|
46 |
|
if ret == 127: |
47 |
|
continue |
48 |
|
|
49 |
|
return True |
50 |
|
|
51 |
class urllister(SGMLParser): |
class urllister(SGMLParser): |
52 |
def reset(self): |
def reset(self): |
53 |
SGMLParser.reset(self) |
SGMLParser.reset(self) |
73 |
return self.path if self.show_path else os.path.basename(self.path) |
return self.path if self.show_path else os.path.basename(self.path) |
74 |
|
|
75 |
def add_dep3(self): |
def add_dep3(self): |
76 |
|
"""Add DEP-3 headers to a patch file""" |
77 |
if self.dep3['valid']: |
if self.dep3['valid']: |
78 |
return False |
return False |
79 |
|
|
99 |
|
|
100 |
# XXX - wrap this at 80 chars |
# XXX - wrap this at 80 chars |
101 |
add_line = True |
add_line = True |
102 |
print >>fdst, "%s: %s" % (header, data) |
print >>fdst, "%s: %s" % (header, "" if data is None else data) |
103 |
|
|
104 |
if add_line: print >>fdst, "" |
if add_line: print >>fdst, "" |
105 |
# Now copy any other data and the patch |
# Now copy any other data and the patch |
108 |
fdst.flush() |
fdst.flush() |
109 |
os.rename(fdst.name, self.path) |
os.rename(fdst.name, self.path) |
110 |
|
|
111 |
|
call_editor(self.path) |
112 |
|
|
113 |
#Author: fwang |
#Author: fwang |
114 |
#Subject: Build fix: Fix glib header inclusion |
#Subject: Build fix: Fix glib header inclusion |
115 |
#Applied-Upstream: commit:30602 |
#Applied-Upstream: commit:30602 |
117 |
#Bug: http://bugzilla.abisource.com/show_bug.cgi?id=13247 |
#Bug: http://bugzilla.abisource.com/show_bug.cgi?id=13247 |
118 |
|
|
119 |
def _read_dep3(self): |
def _read_dep3(self): |
120 |
"""This will also parse git headers""" |
"""Read DEP-3 headers from an existing patch file |
121 |
|
|
122 |
|
This will also parse git headers""" |
123 |
dep3 = {} |
dep3 = {} |
124 |
headers = {} |
headers = {} |
125 |
|
|
187 |
if len(fields) >= 3: |
if len(fields) >= 3: |
188 |
self._svn_author = fields[1] |
self._svn_author = fields[1] |
189 |
|
|
190 |
|
if not hasattr(self, '_svn_author'): |
191 |
|
return None |
192 |
|
|
193 |
return self._svn_author |
return self._svn_author |
194 |
|
|
195 |
def get_upstream_names(): |
def get_upstream_names(): |