rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print U64(oid), r.version, len(r.data)
print u64(oid), r.version, len(r.data)
def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs...
revid = self._dostore(oid, revid, description='packable%d' % i)
revid = self._x_dostore(oid, revid, description='packable%d' % i)
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
revid1 = self._dostore(oid1, data=MinPO(0), description='create1') revid2 = self._dostore(oid1, data=MinPO(1), revid=revid1,
revid1 = self._x_dostore(oid1, data=MinPO(0), description='create1') revid2 = self._x_dostore(oid1, data=MinPO(1), revid=revid1,
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
revid3 = self._dostore(oid1, data=MinPO(2), revid=revid2,
revid3 = self._x_dostore(oid1, data=MinPO(2), revid=revid2,
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
self._dostore(description='create2')
self._x_dostore(description='create2')
def load_value(oid, version=''): data, revid = self._storage.load(oid, version) return zodb_unpickle(data).value
if h < 0: h=t32+h v=h*t32+v
if h < 0: h= t32 + h v = (long(h) << 32) + v
def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32+h v=h*t32+v return v
v=h*t32+v
v = (long(h) << 32) + v
def U64(v, unpack=struct.unpack): """Same as u64 but always returns a long.""" h, v = unpack(">II", v) if h: v=h*t32+v return v
self.sql_log_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.sql_log_model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
def __init__(self): #~ self.read_query(
log = self.sql_log_model.get(iter, 0, 1)
log = self.sql_log_model.get(iter, 0, 1, 2)
def __getstate__(self): hosts = [] iter = self.connections_model.get_iter_root() while iter: host = self.connections_model.get_value(iter, 0) hosts.append(host) iter = self.connections_model.iter_next(iter) sql_logs = [] iter = self.sql_log_model.get_iter_root() while iter: log = self.sql_log_model.get(iter, 0, 1) sql...
self.clipboard.set_text(row[1]) self.pri_clipboard.set_text(row[1])
self.clipboard.set_text(row[2]) self.pri_clipboard.set_text(row[2])
def on_sql_log_activate(self, *args): if len(args) == 1: menuitem = args[0] if menuitem.name == "clear_all_entries": self.sql_log_model.clear() path, column = self.sql_log_tv.get_cursor() row = self.sql_log_model[path] if menuitem.name == "copy_sql_log": self.clipboard.set_text(row[1]) self.pri_clipboard.set_text(row[...
self.current_query.textview.get_buffer().set_text(row[1])
self.current_query.textview.get_buffer().set_text(row[2])
def on_sql_log_activate(self, *args): if len(args) == 1: menuitem = args[0] if menuitem.name == "clear_all_entries": self.sql_log_model.clear() path, column = self.sql_log_tv.get_cursor() row = self.sql_log_model[path] if menuitem.name == "copy_sql_log": self.clipboard.set_text(row[1]) self.pri_clipboard.set_text(row[...
query = tv.get_model()[path][1]
query = tv.get_model()[path][2]
def on_sql_log_activate(self, *args): if len(args) == 1: menuitem = args[0] if menuitem.name == "clear_all_entries": self.sql_log_model.clear() path, column = self.sql_log_tv.get_cursor() row = self.sql_log_model[path] if menuitem.name == "copy_sql_log": self.clipboard.set_text(row[1]) self.pri_clipboard.set_text(row[...
data = []
data = { "connect_timeout": 6 } widget_map = { "password": "passwd" }
def on_cw_test(self, *args): import _mysql; data = [] for n in ["host", "user", "password"]: data.append(self.xml.get_widget("cw_%s" % n).get_text()) try: handle = _mysql.connect(*data) except: self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s<...
data.append(self.xml.get_widget("cw_%s" % n).get_text())
data[widget_map.get(n, n)] = self.xml.get_widget("cw_%s" % n).get_text()
def on_cw_test(self, *args): import _mysql; data = [] for n in ["host", "user", "password"]: data.append(self.xml.get_widget("cw_%s" % n).get_text()) try: handle = _mysql.connect(*data) except: self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s<...
handle = _mysql.connect(*data)
handle = _mysql.connect(**data)
def on_cw_test(self, *args): import _mysql; data = [] for n in ["host", "user", "password"]: data.append(self.xml.get_widget("cw_%s" % n).get_text()) try: handle = _mysql.connect(*data) except: self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s<...
self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s</i>" % (data[0], data[1], data[2], sys.exc_value[1])) return self.show_message("test connection", "successfully connected to host <b>%s</b> with user <b>%s</b>!" % (data[0], data[1]))
self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s</i>" % ( data["host"], data["user"], data["passwd"], sys.exc_value )) return self.show_message("test connection", "successfully connected to host <b>%s</b> with user <b>%s</b>!" % ( data["host"],...
def on_cw_test(self, *args): import _mysql; data = [] for n in ["host", "user", "password"]: data.append(self.xml.get_widget("cw_%s" % n).get_text()) try: handle = _mysql.connect(*data) except: self.show_message("test connection", "could not connect to host <b>%s</b> with user <b>%s</b> and password <b>%s</b>:\n<i>%s<...
conditions = "`%s` %s '%s'" % ( self.fc_combobox[0].get_active_text(), self.fc_op_combobox[0].get_active_text(), self.current_host.escape(self.fc_entry[0].get_text())
def field_operator_value(field, op, value): if op == "ISNULL": return "isnull(`%s`)" % field if op == "NOT ISNULL": return "not isnull(`%s`)" % field eval_kw = "eval: " if value.startswith(eval_kw): return "`%s` %s %s" % (field, op, value[len(eval_kw):]) return "`%s` %s '%s'" % (field, op, self.current_host.escape(valu...
def on_template(self, button, t): current_table = self.get_selected_table() current_fc_table = current_table; if t.find("$table$") != -1: if not current_table: show_message("info", "no table selected!\nyou can't execute a template with $table$ in it, if you have no table selected!") return t = t.replace("$table$", sel...
conditions += " %s `%s` %s '%s'" % (
conditions += " %s %s" % (
def on_template(self, button, t): current_table = self.get_selected_table() current_fc_table = current_table; if t.find("$table$") != -1: if not current_table: show_message("info", "no table selected!\nyou can't execute a template with $table$ in it, if you have no table selected!") return t = t.replace("$table$", sel...
self.fc_combobox[i].get_active_text(), self.fc_op_combobox[i].get_active_text(), self.current_host.escape(self.fc_entry[i].get_text())
field_operator_value( self.fc_combobox[i].get_active_text(), self.fc_op_combobox[i].get_active_text(), self.fc_entry[i].get_text() )
def on_template(self, button, t): current_table = self.get_selected_table() current_fc_table = current_table; if t.find("$table$") != -1: if not current_table: show_message("info", "no table selected!\nyou can't execute a template with $table$ in it, if you have no table selected!") return t = t.replace("$table$", sel...
iter = self.sql_log_model.append((timestamp, log))
log = log.replace("<", "&lt;") log = log.replace(">", "&gt;") iter = self.sql_log_model.append((timestamp, log, olog))
def add_sql_log(self, log): max_len = int(self.config["query_log_max_entry_length"]) if len(log) > max_len: log = log[0:max_len] + "\n/* query with length of %d bytes truncated. */" % len(log); # query = db_to_utf8(log); # query = syntax_highlight_markup(query); # query = rxx.replace(query, "[\r\n\t ]+", " ", Regexx::...
def __init__(self): swing.JFrame.__init__(self, title=\ "CHAT400 - An AS/400 Instant Messenger", \ resizable=0) self.contentPane.setLayout(awt.GridBagLayout()) self.addWindowListener(self) self.chkFullNames = swing.JCheckBox("Show user's full name", 1) self.chkActive = swing.JCheckBox("Show only Active Users", 1) tr...
def __init__(self): swing.JFrame.__init__(self, title=\ "CHAT400 - An AS/400 Instant Messenger", \ resizable=0) try: tmp_srvNam = _session.getHostName() except: tmp_srvNam = "" self.as400 = acc.AS400(tmp_srvNam) rUsrLst = rsc.RUserList(self.as400) rUsrLst.open() rUsrLst.waitForComplete() self.usrDct = {} for idx i...
def __init__(self): swing.JFrame.__init__(self, title=\ "CHAT400 - An AS/400 Instant Messenger", \ resizable=0) # We have to activate this when the script # is ready for production-environments. # self.setDefaultCloseOperation(swing.WindowConstants.DISPOSE_ON_CLOSE) self.contentPane.setLayout(awt.GridBagLayout()) self....
if not sndUsr == "AFVAL": self.statusTxt.text='Message Sended.' else: self.rpyTxt.append("MESSAGE IS SENDED TO TRASHCAN !!!") self.rpyTxt.append("\nALWAYS PAY ATTENTION WHO YOU'RE SENDING TO !!!!\n")
if not sndUsr == "ALL TRASH": self.statusTxt.text='Message Sended.' else: self.rpyTxt.append("MESSAGE IS SENDED TO TRASHCAN !!!") self.rpyTxt.append("\nALWAYS PAY ATTENTION WHO YOU'RE SENDING TO !!!!\n")
def btnActSnd(self, event): cmd = acc.CommandCall(self.as400) #curUsr = self.as400.getUserId() selected = self.users.getSelectedItem() sndUsr =selected.split(':')[0] chatTxt = self.chatTxt.getText() dq = acc.KeyedDataQueue(self.as400, CHATQ) if not dq.exists(): dq.create(KEYLEN, 512) try: if not sndUsr == "ALL TRASH": ...
self.rpyTxt.append("%s>>%s\n"%(curUsr, chatTxt))
self.rpyTxt.append("%s -> %s\n%s\n"%(curUsr, sndUsr, chatTxt))
def btnActSnd(self, event): cmd = acc.CommandCall(self.as400) curUsr = self.as400.getUserId() selected = self.users.getSelectedItem() sndUsr =selected.split(':')[0] chatTxt = self.chatTxt.getText() dq = acc.KeyedDataQueue(self.as400, CHATQ) if not dq.exists(): dq.create(KEYLEN, 512) try: dq.write(sndUsr, "%s::%s"%(curU...
def exit(event): lang.System.exit(0)
def exit(event): lang.System.exit(0)
self.windowClosing = exit
self.windowClosing = self.closing
def __init__(self, title=""): JFrame.__init__(self, title) self.size = 400,500 self.windowClosing = exit label = JLabel(text="Class Name:") label.horizontalAlignment = JLabel.RIGHT tpanel = JPanel(layout = awt.FlowLayout()) self.text = JTextField(20, actionPerformed = self.entered) btn = JButton("Enter", actionPerform...
frame = InfoFrame("Java-to-Jython Event/Property/Method Browser") frame.show()
def main(): frame = InfoFrame("Java-to-Jython Event/Property/Method Browser") frame.show() if __name__=='main' or __name__ =='__main__': main()
def setupTree(self, top, pedict, ppdict, pmdict): tree_model = SampleModel(top) events = tree_model.addNode("Events",["<<Events of the class and its ancestors>>"]) props = tree_model.addNode("Properties",["<<Properties of the class and its ancestors>>"]) meths = tree_model.addNode("Methods",["<<Methods of the class and...
def test_date_triple_value(self):
def test_date_tuple_value(self):
def test_date_triple_value(self): self.assertEqual(self.date.tuple(), (2004, 9, 4, 0, 17, 15.799999977461994))
saturn_attributes = ('earth_tilt', 'sun_tilt')
def test_date_triple_value(self): self.assertEqual(self.date.tuple(), (2004, 9, 4, 0, 17, 15.799999977461994))
'rise_time', 'rise_az', 'transit_time', 'transit_alt', 'set_time', 'set_az')),
'circumpolar', 'neverup', 'rise_time', 'rise_az', 'transit_time', 'transit_alt', 'set_time', 'set_az')),
def test_date_triple_value(self): self.assertEqual(self.date.tuple(), (2004, 9, 4, 0, 17, 15.799999977461994))
self.o = o = Observer() o.lat, o.long, o.elev = '33:45:10', '-84:23:37', 320.0 o.date = '1997/2/15' def predict_attributes(self, body, was_computed, was_given_observer): predictions = {} for bodytype, needs_observer, attrs in attribute_list: for attr in attrs: if not isinstance(body, bodytype): predictions[attr] ...
self.date = Date('1955/05/21') self.obs = obs = Observer() obs.lat, obs.long, obs.elev = '33:45:10', '-84:23:37', 320.0 obs.date = '1997/2/15'
def setUp(self): self.o = o = Observer() o.lat, o.long, o.elev = '33:45:10', '-84:23:37', 320.0 o.date = '1997/2/15'
p = self.predict_attributes(body, was_computed, was_given_observer)
p = predict_attributes(body, was_computed, was_given_observer)
def compare_attributes(self, body, was_computed, was_given_observer): p = self.predict_attributes(body, was_computed, was_given_observer) t = self.measure_attributes(body) for a in Set(p).union(t): if p[a] is None and t[a] is None: continue if p[a] and isinstance(t[a], p[a]): continue if was_computed: if was_given_obse...
body.compute(self.o)
body.compute(self.obs)
def run(self, body): self.compare_attributes(body, False, False) body.compute() self.compare_attributes(body, True, False) body.compute(self.o) self.compare_attributes(body, True, True) body.compute() self.compare_attributes(body, True, False)
def test_Fixed(self): fb = FixedBody() fb._epoch, fb._ra, fb._dec = '2000', '1:30', '15:00' self.run(fb)
def build(self, bodytype, line, attributes): bl = readdb(line) ba = bodytype() for attribute, value in attributes.iteritems(): try: setattr(ba, attribute, value) except TypeError: raise TestError, ('cannot modify attribute %s of %r: %s' % (attribute, ba, sys.exc_info()[1])) if not isinstance(bl, bodytype): raise ...
def test_Fixed(self): fb = FixedBody() fb._epoch, fb._ra, fb._dec = '2000', '1:30', '15:00' self.run(fb)
def _esql_preprocess(file): return cfile
def _esql_preprocess(file): return cfile
y2,m2 = divmod(m+self._months,12)
y2,m2 = divmod(m-1+self._months,12)
def __add__(self, other): if isinstance(other, IntervalYearToMonth): return self.__class__(0, int(self._months+other._months)) elif isinstance(other, (datetime.datetime, datetime.date)): # extract the date from the other operand y,m,d = other.timetuple()[0:3] otherdate = datetime.date(y,m,d) # shift the date by the des...
date2 = datetime.date(y+y2,m2,d)
date2 = datetime.date(y+y2,m2+1,d)
def __add__(self, other): if isinstance(other, IntervalYearToMonth): return self.__class__(0, int(self._months+other._months)) elif isinstance(other, (datetime.datetime, datetime.date)): # extract the date from the other operand y,m,d = other.timetuple()[0:3] otherdate = datetime.date(y,m,d) # shift the date by the des...
if model.type_name in ('state', 'subgraph'): item = self.current_iconview().currentItem() if item: item.update_model()
def edsm_model_updated(self, model): if model.type_name in ('state', 'subgraph'): item = self.current_iconview().currentItem() if item: item.update_model() self.emit_graph_changed()
name = model.name
iconview_name = model.id
def edsm_delete_state(self, state): iconview = state.iconView() if iconview: iconview.takeItem(state) model = state._model if isinstance(state, IconViewSubgraphIcon): name = model.name for iconview in self.iconviews(1): if iconview.name() == name: iconview.clear() self.edsm_tabs.removePage(iconview) model.discard() sel...
if iconview.name() == name:
if iconview.name() == iconview_name:
def edsm_delete_state(self, state): iconview = state.iconView() if iconview: iconview.takeItem(state) model = state._model if isinstance(state, IconViewSubgraphIcon): name = model.name for iconview in self.iconviews(1): if iconview.name() == name: iconview.clear() self.edsm_tabs.removePage(iconview) model.discard() sel...
svntest.main.run_svn(None, 'ps', 'foo', 'bar', os.path.join(wc_dir, 'A', 'D'))
svntest.main.run_svn(None, 'ps', 'foo', 'bar', D_path)
def hudson_part_2(sbox): "hudson prob 2.0: prop commit on old dir fails." if sbox.build(): return 1 wc_dir = sbox.wc_dir # Remove gamma from the working copy. gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') svntest.main.run_svn(None, 'rm', gamma_path) # Create expected commit output. output_list = [ [gamma_pa...
"out-of-date",
"not up-to-date",
def hudson_part_2(sbox): "hudson prob 2.0: prop commit on old dir fails." if sbox.build(): return 1 wc_dir = sbox.wc_dir # Remove gamma from the working copy. gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') svntest.main.run_svn(None, 'rm', gamma_path) # Create expected commit output. output_list = [ [gamma_pa...
if svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir): return 1 return 0
return svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir)
def merge_mixed_revisions(sbox): "commit mixed-rev wc (no erronous merge error)" if sbox.build(): return 1 wc_dir = sbox.wc_dir # Make some convenient paths. iota_path = os.path.join(wc_dir, 'iota') H_path = os.path.join(wc_dir, 'A', 'D', 'H') chi_path = os.path.join(wc_dir, 'A', 'D', 'H', 'chi') omega_path = os.pat...
if svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir): return 1 return 0
return svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir)
def commit_uri_unsafe(sbox): "commit files and dirs with URI-unsafe characters" if sbox.build(): return 1 wc_dir = sbox.wc_dir # Make some convenient paths. hash_dir = os.path.join(wc_dir, '#hash#') nasty_dir = os.path.join(wc_dir, '#![]{}()<>%') space_path = os.path.join(wc_dir, 'A', 'D', 'space path') bang_path = ...
if svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir): return 1 return 0
return svntest.actions.run_and_verify_commit (wc_dir, expected_output_tree, expected_status_tree, None, None, None, None, None, wc_dir)
def commit_deleted_edited(sbox): "commit files that have been deleted, but also edited" if sbox.build(): return 1 wc_dir = sbox.wc_dir # Make some convenient paths. iota_path = os.path.join(wc_dir, 'iota') mu_path = os.path.join(wc_dir, 'A', 'mu') # Edit the files. svntest.main.file_append(iota_path, "This file has...
a_t = util.apr_ansi_time_to_apr_time(self.t_max)[1]
a_t = util.apr_time_ansi_put(self.t_max)[1]
def get_metadata(self, pool): # by definition, the author and log message must be the same for all # items that went into this commit. therefore, just grab any item from # our record of changes/deletes. if self.changes: file, rev = self.changes[0] else: # there better be one... file, rev = self.deletes[0]
digest = sha.new(log + author).hexdigest()
digest = sha.new(log + '\0' + author).hexdigest()
def set_revision_info(self, revision, log, text): timestamp, author, op, old_ts = self.rev_data[revision] digest = sha.new(log + author).hexdigest() if old_ts: # the timestamp on this revision was changed. log it for later # resynchronization of other files's revisions that occurred # for this time and log message. sel...
print 'USAGE: %s [-v] [-p pass] repository-path' % sys.argv[0]
print 'USAGE: %s [-v] [-s svn-repos-path] [-p pass] repository-path' \ % sys.argv[0]
def usage(): print 'USAGE: %s [-v] [-p pass] repository-path' % sys.argv[0] sys.exit(1)
opts, args = getopt.getopt(sys.argv[1:], 'p:v')
opts, args = getopt.getopt(sys.argv[1:], 'p:s:v')
def main(): opts, args = getopt.getopt(sys.argv[1:], 'p:v') if len(args) != 1: usage() verbose = 0 start_pass = 1 for opt, value in opts: if opt == '-p': start_pass = int(value) if start_pass < 1 or start_pass > len(_passes): print 'ERROR: illegal value (%d) for starting pass. ' \ 'must be 1 through %d.' % (start_pas...
util.run_app(convert, args[0], start_pass=start_pass, verbose=verbose)
elif opt == '-s': target = value util.run_app(convert, args[0], start_pass=start_pass, verbose=verbose, target=target)
def main(): opts, args = getopt.getopt(sys.argv[1:], 'p:v') if len(args) != 1: usage() verbose = 0 start_pass = 1 for opt, value in opts: if opt == '-p': start_pass = int(value) if start_pass < 1 or start_pass > len(_passes): print 'ERROR: illegal value (%d) for starting pass. ' \ 'must be 1 through %d.' % (start_pas...
prnt_n = `n` if n < 10: prnt_n = " " + prnt_n print " ", prnt_n, " ", x.__doc__
print " %2d %s" % (n, x.__doc__)
def run_tests(test_list): "Main routine to run all tests in TEST_LIST." global test_area_url testnum = 0 for arg in sys.argv: if arg == "list": print "Test # Test Description" print "------ ----------------" n = 1 for x in test_list[1:]: prnt_n = `n` if n < 10: prnt_n = " " + prnt_n print " ", prnt_n, " ...
dep_path = tlib.path if bldtype == 'lib': if lib[:3] == 'lib': lib = lib[3:] libs.append('-L%s -l%s' % (retreat + os.path.join(dep_path, '.libs'), lib)) else: libs.append(retreat + os.path.join(dep_path, lib + '.la'))
libs.append(retreat + os.path.join(tlib.path, lib + '.la'))
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } instal...
base, ext = os.path.splitext(os.path.basename(file))
dirname, fname = os.path.split(file) base, ext = os.path.splitext(fname)
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } instal...
ofile.write('\t$(INSTALL_MOD_SHARED) -n %s %s\n' % (name, file))
ofile.write('\tcd %s ; $(INSTALL_MOD_SHARED) -n %s %s\n' % (dirname, name, fname))
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } instal...
ofile.write('\t$(INSTALL_%s) %s %s\n' % (string.upper(area_var), file, os.path.join('$(%sdir)' % area_var, os.path.basename(file))))
dirname, fname = os.path.split(file) ofile.write('\tcd %s ; $(INSTALL_%s) %s %s\n' % (dirname, string.upper(area_var), fname, os.path.join('$(%sdir)' % area_var, fname)))
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } instal...
return 1
else: return 1
def compare_line_lists(expected_lines, actual_lines, regexp): """Compare two lists of lines (ignoring orderings), and return 0 if they are the same or 1 if they are different. Specifically, matches will be made between each line in EXPECTED_LINES and those in ACTUAL_LINES using REGEXP. If a line has no match, or if o...
el = ['A /foo/bar', 'M /foo/baz', 'D blee'] al = ['M /foo/baz', 'D blee', 'A /foo/bar',] rm = re.compile(r"^(..)\s+(.+)") print "comparing sets, result is:", compare_line_lists(el, al, rm)
def compare_line_lists(expected_lines, actual_lines, regexp): """Compare two lists of lines (ignoring orderings), and return 0 if they are the same or 1 if they are different. Specifically, matches will be made between each line in EXPECTED_LINES and those in ACTUAL_LINES using REGEXP. If a line has no match, or if o...
target_deps = { }
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
targets = _filter_targets(parser.sections()) for target in targets: path = parser.get(target, 'path') target_dirs[path] = None install_type = parser.get(target, 'install') bldtype = parser.get(target, 'type') if bldtype == 'exe': tfile = target objext = '.o' if not install_type: install_type = 'bin' elif bldtype == '...
target_names = _filter_targets(parser.sections()) for target in target_names: try: target_ob = Target(target, parser.get(target, 'path'), parser.get(target, 'install'), parser.get(target, 'type')) except GenMakeError, e: print e
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
tpath = os.path.join(path, tfile)
targets[target] = target_ob group = parser.get(target, 'group') if groups.has_key(group): groups[group].append(target_ob.output) else: groups[group] = [ target_ob.output ] if errors: sys.exit(1) for target in target_names: target_ob = targets[target] path = target_ob.path install_type = target_ob.install bldtype =...
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
target_deps[target] = [ ]
deps = [ ]
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
if lib in targets: target_deps[target].append(lib) dep_path = parser.get(lib, 'path')
if lib in target_names: tlib = targets[lib] target_ob.deps.append(tlib) deps.append(tlib.output) dep_path = tlib.path
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
% (targ_varname, objstr, string.join(target_deps[target]),
% (targ_varname, objstr, string.join(deps),
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
group = parser.get(target, 'group') if groups.has_key(group): groups[group].append(target) else: groups[group] = [ target ] for group in groups.keys(): group_deps = _sort_deps(groups[group], target_deps) for i in range(len(group_deps)): group_deps[i] = build_targets[group_deps[i]] ofile.write('%s: %s\n\n' % (group, st...
for g_name, g_targets in groups.items(): ofile.write('%s: %s\n\n' % (g_name, string.join(g_targets)))
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
for dep in target_deps[t]: bt = build_targets[dep]
for dep in targets[t].deps: bt = dep.output
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 groups = { } target_...
def _sort_deps(targets, deps): "Sort targets based on dependencies specified in deps." order = { } for i in range(len(targets)): order[targets[i]] = i for t in targets: thisval = order[t] for dep in deps[t]: if order.get(dep, -1) > thisval: order[t] = order[dep] order[dep] = thisval thisval = order[t] targets = ta...
def _filter_clean_files(fname): "Filter files which have a suffix handled by the standard 'clean' rule." # for now, we only look for .la which keeps this code simple. return fname[-3:] != '.la'
"commit a file inside a directory that's already scheduled to be added"
"commit a file inside dir scheduled for addition"
def commit_in_dir_scheduled_for_addition(sbox): "commit a file inside a directory that's already scheduled to be added" if sbox.build(): return 1 wc_dir = sbox.wc_dir A_path = os.path.join(wc_dir, 'A') Z_path = os.path.join(wc_dir, 'Z') mu_path = os.path.join(wc_dir, 'Z', 'mu') svntest.main.run_svn(None, 'move', A_...
xreadlines(self.log)))
self.log.readlines()))
def run(self, list): 'Run all test programs given in LIST.' self._open_log('w') failed = 0 for prog in list: failed = self._run_test(prog) or failed if failed: print 'At least one test FAILED, checking ' + self.logfile self._open_log('r') map(sys.stdout.write, filter(lambda x: x[:4] == 'FAIL', xreadlines(self.log))) se...
os.dup2(self.log.fileno(), 1) os.dup2(self.log.fileno(), 2) rv = os.spawnv(os.P_WAIT, cmdline[0], cmdline) os.dup2(old_stdout, 1) os.dup2(old_stderr, 2) os.close(old_stdout) os.close(old_stderr) return rv
try: os.dup2(self.log.fileno(), 1) os.dup2(self.log.fileno(), 2) rv = os.spawnv(os.P_WAIT, cmdline[0], cmdline) except: restore_streams(old_stdout, old_stderr) raise else: restore_streams(old_stdout, old_stderr) return rv
def _run_prog(self, cmdline): 'Execute COMMAND, redirecting standard output and error to the log file.' self.log.flush() old_stdout = os.dup(1) old_stderr = os.dup(2) os.dup2(self.log.fileno(), 1) os.dup2(self.log.fileno(), 2) rv = os.spawnv(os.P_WAIT, cmdline[0], cmdline) os.dup2(old_stdout, 1) os.dup2(old_stderr, 2) ...
output, errput = main.run_svn(1, "proplist", path)
output, errput = main.run_svn(1, "proplist", path, "--verbose")
def get_props(path): "Return a hash of props for PATH, using the svn client." # It's not kosher to look inside .svn/ and try to read the internal # property storage format. Instead, we use 'svn proplist'. After # all, this is the only way the user can retrieve them, so we're # respecting the black-box paradigm. pro...
"Return a status list reflecting local mods made by next routine."
"Return a status list reflecting the local mods made by make_standard_slew_of_changes()."
def get_standard_status_list(wc_dir): "Return a status list reflecting local mods made by next routine." status_list = svntest.actions.get_virginal_status_list(wc_dir, '1') ### todo: use status-hash below instead. # `.' status_list[0][3]['status'] = '_M' # A/B/lambda, A/D status_list[5][3]['status'] = 'M ' status_...
["svn_delta.i"], libraries=['svn_fs', 'svn_swig_py', 'swigpy'],
["../svn_delta.i"], libraries=['svn_delta', 'svn_swig_py', 'swigpy'],
def swig_sources(self, sources): swig = self.find_swig() swig_cmd = [swig, "-c", "-python"] for dir in self.include_dirs: swig_cmd.append("-I" + dir)
libraries=['svn_ra', 'svn_swig_py', 'swigpy'],
libraries=['svn_repos', 'svn_swig_py', 'swigpy'],
def swig_sources(self, sources): swig = self.find_swig() swig_cmd = [swig, "-c", "-python"] for dir in self.include_dirs: swig_cmd.append("-I" + dir)
libraries=['svn_ra', 'swigpy'],
libraries=['svn_subr', 'swigpy', 'apr'],
def swig_sources(self, sources): swig = self.find_swig() swig_cmd = [swig, "-c", "-python"] for dir in self.include_dirs: swig_cmd.append("-I" + dir)
def commit(self):
def get_metadata(self, pool): if self.changes: file, rev = self.changes[0] else: file, rev = self.deletes[0] rip = RevInfoParser() rip.parse_cvs_file(file) author = rip.authors[rev] log = rip.logs[rev] a_t = util.apr_ansi_time_to_apr_time(self.t_max)[1] date = util.svn_time_to_nts(a_t, pool) return author, log...
def commit(self): # commit this transaction print 'committing: %s, over %d seconds' % (time.ctime(self.t_min), self.t_max - self.t_min) for f, r in self.changes: print ' changing %s : %s' % (r, f) for f, r in self.deletes: print ' deleting %s : %s' % (r, f)
print ' changing %s : %s' % (r, f)
repos_path = '/' + relative_name(ctx.cvsroot, f[:-2]) print ' changing %s : %s' % (r, repos_path) dirname = os.path.dirname(repos_path) if dirname != '/': parts = string.split(dirname[1:], os.sep) for i in range(1, len(parts) + 1): parent_dir = '/' + string.join(parts[:i], '/') if fs.check_path(root, parent_di...
def commit(self): # commit this transaction print 'committing: %s, over %d seconds' % (time.ctime(self.t_min), self.t_max - self.t_min) for f, r in self.changes: print ' changing %s : %s' % (r, f) for f, r in self.deletes: print ' deleting %s : %s' % (r, f)
print ' deleting %s : %s' % (r, f)
repos_path = '/' + relative_name(ctx.cvsroot, f[:-2]) print ' deleting %s : %s' % (r, repos_path) if r != '1.1': fs.delete(root, repos_path, f_pool) util.svn_pool_clear(f_pool) author, log, date = self.get_metadata(c_pool) fs.change_txn_prop(txn, 'svn:author', author, c_pool) fs.change_txn_prop(txn, 'svn:l...
def commit(self): # commit this transaction print 'committing: %s, over %d seconds' % (time.ctime(self.t_min), self.t_max - self.t_min) for f, r in self.changes: print ' changing %s : %s' % (r, f) for f, r in self.deletes: print ' deleting %s : %s' % (r, f)
c.commit()
c.commit(t_fs, ctx) count = count + len(process) if commits: process = [ ] for id, c in commits.items(): process.append((c.t_max, c)) process.sort() for t_max, c in process: c.commit(t_fs, ctx)
def pass4(ctx): # process the logfiles, creating the target commits = { } count = 0 for line in fileinput.FileInput(ctx.log_fname_base + SORTED_REVS_SUFFIX): timestamp, id, op, rev, fname = parse_revs_line(line) if commits.has_key(id): c = commits[id] else: c = commits[id] = Commit() c.add(timestamp, op, fname, rev) ...
def convert(cvsroot, target=SVNROOT, log_fname_base=DATAFILE, start_pass=1, verbose=0):
def convert(pool, cvsroot, target=SVNROOT, log_fname_base=DATAFILE, start_pass=1, verbose=0):
def convert(cvsroot, target=SVNROOT, log_fname_base=DATAFILE, start_pass=1, verbose=0): "Convert a CVS repository to an SVN repository." # prepare the operation context ctx = _ctx() ctx.cvsroot = cvsroot ctx.target = target ctx.log_fname_base = log_fname_base ctx.verbose = verbose times = [ None ] * len(_passes) for ...
print 'USAGE: %s [-p pass] repository-path' % sys.argv[0]
print 'USAGE: %s [-v] [-p pass] repository-path' % sys.argv[0]
def usage(): print 'USAGE: %s [-p pass] repository-path' % sys.argv[0] sys.exit(1)
convert(args[0], start_pass=start_pass, verbose=verbose)
util.run_app(convert, args[0], start_pass=start_pass, verbose=verbose)
def main(): opts, args = getopt.getopt(sys.argv[1:], 'p:v') if len(args) != 1: usage() verbose = 0 start_pass = 1 for opt, value in opts: if opt == '-p': start_pass = int(value) if start_pass < 1 or start_pass > len(_passes): print 'ERROR: illegal value (%d) for starting pass. ' \ 'must be 1 through %d.' % (start_pass,...
url = os.path.join(svntest.main.test_area_url, svntest.main.general_repo_dir, sbox.name) print url
url = svntest.main.test_area_url + '/' + svntest.main.current_repo_dir
def diff_pure_repository_update_a_file(sbox): "pure repository diff update a file" if sbox.build(): return 1 wc_dir = sbox.wc_dir was_cwd = os.getcwd() os.chdir(wc_dir) update_a_file() svntest.main.run_svn(None, 'ci') os.chdir(was_cwd) url = os.path.join(svntest.main.test_area_url, svntest.main.general_repo_dir, sbo...
files = [ ] for t in inst_targets: files.append(t.output)
files = _sorted_files(inst_targets)
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } instal...
status_list[6][3]['wc_rev'] = '0'
def get_standard_status_list(wc_dir): "Return a status list reflecting local mods made by next routine." status_list = svntest.actions.get_virginal_status_list(wc_dir, '1') ### todo: use status-hash below instead. # `.' status_list[0][3]['status'] = '_M' # A/B/lambda, A/D status_list[5][3]['status'] = 'M ' status_...
status_list[18][3]['wc_rev'] = '0'
def get_standard_status_list(wc_dir): "Return a status list reflecting local mods made by next routine." status_list = svntest.actions.get_virginal_status_list(wc_dir, '1') ### todo: use status-hash below instead. # `.' status_list[0][3]['status'] = '_M' # A/B/lambda, A/D status_list[5][3]['status'] = 'M ' status_...
% (targ_varname, string.join(objects), string.join(deps),
% (targ_varname, string.join(objects + deps), add_deps,
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } groups...
commit_deleted_edited
commit_deleted_edited, commit_in_dir_scheduled_for_addition,
def commit_deleted_edited(): "commit files that have been deleted, but also edited" # Bootstrap: make independent repo and working copy. sbox = sandbox(commit_deleted_edited) wc_dir = os.path.join(svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Make some convenient paths. io...
script_dirs = [] for script in scripts: script_dirs.append(re.compile("[-a-z0-9A-Z_.]*$").sub("", script))
def write(self): errors = 0 for target in self.target_names: target_ob = self.targets[target]
self.ofile.write('BUILD_DIRS = %s %s\n' % (string.join(self.target_dirs.keys()), string.join(script_dirs)))
script_dirs = map(os.path.dirname, scripts + fs_scripts) build_dirs = self.target_dirs.copy() for d in script_dirs: build_dirs[d] = None self.ofile.write('BUILD_DIRS = %s\n' % string.join(build_dirs.keys()))
def write(self): errors = 0 for target in self.target_names: target_ob = self.targets[target]
commit_multiple_targets
commit_multiple_targets, commit_multiple_targets_2
def commit_multiple_targets(): "commit multiple targets" wc_dir = os.path.join (general_wc_dir, 'commit_multiple_targets') if make_repo_and_wc('commit_multiple_targets'): return 1 # This test will commit three targets: psi, B, and pi. In that order. # Make local mods to many files. AB_path = os.path.join(wc_dir, ...
"ensure update is not reporting additions"
"ensure update is not munging additions or replacements"
def update_ignores_added(): "ensure update is not reporting additions" sbox = sandbox(update_ignores_added) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Create a new file, 'zeta', and schedule it for addition. zeta_path = os.path.join(wc_dir, 'A', 'B...
gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') svntest.main.run_svn(None, 'delete', gamma_path) svntest.main.file_append(gamma_path, "\nThis is a new 'gamma' now.") svntest.main.run_svn(None, 'add', gamma_path)
def update_ignores_added(): "ensure update is not reporting additions" sbox = sandbox(update_ignores_added) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Create a new file, 'zeta', and schedule it for addition. zeta_path = os.path.join(wc_dir, 'A', 'B...
status_list = svntest.actions.get_virginal_status_list(wc_dir, '1')
status_list = svntest.actions.get_virginal_status_list(wc_dir, '2') for item in status_list: if item[0] == gamma_path: item[3]['wc_rev'] = '1' item[3]['status'] = 'R '
def update_ignores_added(): "ensure update is not reporting additions" sbox = sandbox(update_ignores_added) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Create a new file, 'zeta', and schedule it for addition. zeta_path = os.path.join(wc_dir, 'A', 'B...
'repos_rev' : '1'}])
'repos_rev' : '2'}])
def update_ignores_added(): "ensure update is not reporting additions" sbox = sandbox(update_ignores_added) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Create a new file, 'zeta', and schedule it for addition. zeta_path = os.path.join(wc_dir, 'A', 'B...
out, err = svntest.main.run_svn(1, 'commit', '-m', '"logmsg"', mu_path) if len(err) == 0: return 1 return 0
if svntest.actions.run_and_verify_commit (wc_dir, None, None, "unversioned", None, None, None, None, mu_path): return 1 Q_path = os.path.join(wc_dir, 'Q') bloo_path = os.path.join(Q_path, 'bloo') os.mkdir(Q_path) svntest.main.file_append(bloo_path, "New contents.") svntest.main.run_svn(None, 'add', '--recursive', Q_p...
def commit_in_dir_scheduled_for_addition(sbox): "commit a file inside dir scheduled for addition" if sbox.build(): return 1 wc_dir = sbox.wc_dir A_path = os.path.join(wc_dir, 'A') Z_path = os.path.join(wc_dir, 'Z') mu_path = os.path.join(wc_dir, 'Z', 'mu') svntest.main.run_svn(None, 'move', A_path, Z_path) out, er...
"Return a status list reflecting the local mods made by make_standard_slew_of_changes()."
def get_standard_status_list(wc_dir): "Return a status list reflecting the local mods made by make_standard_slew_of_changes()." status_list = svntest.actions.get_virginal_status_list(wc_dir, '1') ### todo: use status-hash below instead. # `.' status_list[0][3]['status'] = '_M' # A/B/lambda, A/D status_list[5][3]['...
objects.append(objname) file_deps.append((src, objname)) elif src[-5:] == '.texi': objname = src[:-5] + objext
def main(fname, oname=None, skip_depends=0): parser = ConfigParser.ConfigParser(_cfg_defaults) parser.read(fname) if oname is None: oname = os.path.splitext(os.path.basename(fname))[0] + '-outputs.mk' ofile = open(oname, 'w') ofile.write('# DO NOT EDIT -- AUTOMATICALLY GENERATED\n\n') errors = 0 targets = { } groups...
tfile = name self.objext = '.info'
def __init__(self, name, path, install, type): self.name = name self.deps = [ ] # dependencies (list of other Target objects) self.path = path self.type = type
got_error = run_one_test(n, test_list)
if run_one_test(n, test_list): got_error = 1
def run_tests(test_list): "Main routine to run all tests in TEST_LIST." testnum = 0 # Parse commandline arg, list tests or run one test if (len(sys.argv) > 1): if (sys.argv[1] == 'list'): print "Test # Test Description" print "------ ----------------" n = 1 for x in test_list[1:]: print " ", n, " ", x.__d...
status_list = svntest.actions.get_virginal_status_list(wc_dir, 1)
status_list = svntest.actions.get_virginal_status_list(wc_dir, '1')
def commit_props(): "commit properties" # Bootstrap sbox = sandbox(commit_props) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Add a property to a file and a directory mu_path = os.path.join(wc_dir, 'A', 'mu') H_path = os.path.join(wc_dir, 'A', 'D', '...
status_list = svntest.actions.get_virginal_status_list(wc_dir, 1)
status_list = svntest.actions.get_virginal_status_list(wc_dir, '1')
def update_props(): "receive properties via update" # Bootstrap sbox = sandbox(update_props) wc_dir = os.path.join (svntest.main.general_wc_dir, sbox) if svntest.actions.make_repo_and_wc(sbox): return 1 # Make a backup copy of the working copy wc_backup = wc_dir + 'backup' svntest.actions.duplicate_dir(wc_dir, wc_ba...