rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self._out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['+diff+']>>')
self._out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['+self.diffs[diff]+']>>')
def _putfonts(self): nf=self.n for diff in self.diffs: #Encodings self._newobj() self._out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['+diff+']>>') self._out('endobj') for name,info in self.font_files.iteritems(): #Font file embedding self._newobj() self.font_files[name]['n']=self.n font='' f=file(...
self._out('/Encoding '+(nf+font['diff'])+' 0 R')
self._out('/Encoding '+str(nf+font['diff'])+' 0 R')
def _putfonts(self): nf=self.n for diff in self.diffs: #Encodings self._newobj() self._out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['+diff+']>>') self._out('endobj') for name,info in self.font_files.iteritems(): #Font file embedding self._newobj() self.font_files[name]['n']=self.n font='' f=file(...
if self.align[0].upper() == 'C':
if self.align and self.align[0].upper() == 'C':
def handle_starttag(self, tag, attrs): attrs = dict(attrs) if DEBUG: print "STARTTAG", tag, attrs if tag=='b' or tag=='i' or tag=='u': self.set_style(tag,1) if tag=='a': self.href=attrs['href'] if tag=='br': self.pdf.ln(5) if tag=='p': self.pdf.ln(5) if attrs: self.align=attrs['align'].lower() if tag in ('h1', 'h2', 'h...
h2p.feed(html)
h2p.feed(text)
def write_html(self, text): "Parse HTML and convert it to PDF" h2p = HTML2FPDF(self) h2p.feed(html)
if self.href: self.put_link(self.href,txt) elif self.td is not None:
if self.td is not None:
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
if bgcolor: fill_color = self.pdf.fill_color self.pdf.set_fill_color(*bgcolor) self.pdf.rect(self.pdf.x, self.pdf.y, w, h, 'F') self.pdf.fill_color = fill_color
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
self.theader.append((w,h,txt,border,0,align, bgcolor and 1))
self.theader.append(((w,h,txt,border,0,align), bgcolor))
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
self.tfooter.append((w,h,txt,border,0,align, bgcolor and 1))
self.tfooter.append(((w,h,txt,border,0,align), bgcolor))
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
height = h + (self.tfooter and self.tfooter[0][1] or 0)
height = h + (self.tfooter and self.tfooter[0][0][1] or 0)
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
self.pdf.cell(w,h,txt,border,0,align, bgcolor)
self.box_shadow(w, h, bgcolor) self.pdf.cell(w,h,txt,border,0,align)
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
self.pdf.cell(0,self.h,txt,0,1,self.aling[0].upper())
self.pdf.cell(0,self.h,txt,0,1,self.aling[0].upper(), self.href)
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
print "write", txt, "*" self.pdf.write(self.h,txt)
if self.href: self.put_link(self.href,txt) else: print "write", txt, "*" self.pdf.write(self.h,txt) def box_shadow(self, w, h, bgcolor): print "box_shadow", w, h, bgcolor if bgcolor: fill_color = self.pdf.fill_color self.pdf.set_fill_color(*bgcolor) self.pdf.rect(self.pdf.x, self.pdf.y, w, h, 'F') self.pdf.fill_color ...
def handle_data(self, txt): if self.href: self.put_link(self.href,txt) elif self.td is not None: if 'width' not in self.td and 'colspan' not in self.td: l = [self.table_col_width[self.table_col_index]] elif 'colspan' in self.td: i = self.table_col_index colspan = int(self.td['colspan']) l = self.table_col_width[i:i+col...
for cell in self.theader:
for cell, bgcolor in self.theader: self.box_shadow(cell[0], cell[1], bgcolor)
def output_table_header(self): if self.theader: b = self.b self.set_style('B',True) for cell in self.theader: self.pdf.cell(*cell) self.set_style('B',b) self.pdf.ln(self.theader[0][1]) self.theader_out = True
self.pdf.ln(self.theader[0][1])
self.pdf.ln(self.theader[0][0][1])
def output_table_header(self): if self.theader: b = self.b self.set_style('B',True) for cell in self.theader: self.pdf.cell(*cell) self.set_style('B',b) self.pdf.ln(self.theader[0][1]) self.theader_out = True
for cell in self.tfooter:
for cell, bgcolor in self.tfooter: self.box_shadow(cell[0], cell[1], bgcolor)
def output_table_footer(self): if self.tfooter: self.output_table_sep() for cell in self.tfooter: self.pdf.cell(*cell) self.pdf.ln(self.tfooter[0][1]) self.output_table_sep() self.tfooter_out = True
self.pdf.ln(self.tfooter[0][1])
self.pdf.ln(self.tfooter[0][0][1])
def output_table_footer(self): if self.tfooter: self.output_table_sep() for cell in self.tfooter: self.pdf.cell(*cell) self.pdf.ln(self.tfooter[0][1]) self.output_table_sep() self.tfooter_out = True
if tag=='h1':
if tag 'h1':
def handle_starttag(self, tag, attrs): attrs = dict(attrs) print "STARTTAG", tag, attrs if tag=='b' or tag=='i' or tag=='u': self.set_style(tag,1) if tag=='a': self.href=attrs['href'] if tag=='br': self.pdf.ln(5) if tag=='p': self.pdf.ln(5) if attrs: self.align=attrs['align'].lower() if tag=='h1': self.pdf.ln(5) self.p...
self.set_style('b', False)
self.set_style('i', False)
def set_font(self, face=None, size=None): if face: self.font_face = face if size: self.font_size = size self.h = size / 72.0*25.4 print "H", self.h self.pdf.set_font(self.font_face or 'times','',12) self.pdf.set_font_size(self.font_size or 12) self.set_style('u', False) self.set_style('b', False) self.set_style('b', Fa...
html="""
if __name__=='__main__': html="""
def put_line(self): self.pdf.ln(2) self.pdf.line(self.pdf.get_x(),self.pdf.get_y(),self.pdf.get_x()+187,self.pdf.get_y()) self.pdf.ln(3)
<thead> <tr><th width="30%">Header 1</th><th width="70%">header 2</th></tr> </thead> <tfoot> <tr><td>footer 1</td><td>footer 2</td></tr> </tfoot>
<thead><tr bgcolor=" <tfoot><tr bgcolor="
def put_line(self): self.pdf.ln(2) self.pdf.line(self.pdf.get_x(),self.pdf.get_y(),self.pdf.get_x()+187,self.pdf.get_y()) self.pdf.ln(3)
txt2=txt.replace(')','\\)').replace('(','\\(').replace('\\','\\\\')
txt2=txt.replace('\\','\\\\').replace(')','\\)').replace('(','\\(')
def cell(self, w,h=0,txt='',border=0,ln=0,align='',fill=0,link=''): "Output a cell" k=self.k if(self.y+h>self.page_break_trigger and not self.in_footer and self.accept_page_break()): #Automatic page break x=self.x ws=self.ws if(ws>0): self.ws=0 self._out('0 Tw') self.add_page(self.cur_orientation) self.x=x if(ws>0): se...
return s.replace(')','\\)').replace('(','\\(').replace('\\','\\\\')
return s.replace('\\','\\\\').replace(')','\\)').replace('(','\\(')
def _escape(self, s): #Add \ before \, ( and ) return s.replace(')','\\)').replace('(','\\(').replace('\\','\\\\')
super(Schwefel,self).setup()
super(Schwefel221,self).setup()
def setup(self): super(Schwefel,self).setup() self._set_constraints(((-500,500),) * self.dims)
return retlist
return retlist[1:]
def simplify(somelist): olditem = None retlist = [] for item in somelist: if not olditem or item[1] != olditem[1]: if olditem: retlist.append(olditem) retlist.append(item) olditem = item retlist.append(olditem) return retlist
except:
except Exception, e:
def main(): parser = optparse.OptionParser() parser.add_option('-a', '--address', help='appserver hostname') parser.add_option('-p', '--port', type='int', help='appserver port number') parser.add_option('-v', '--verbose', action='store_true') parser.set_defaults(address='localhost', port=8081, verbose=False) options, a...
source_date=datetime.datetime(2003, 3, 3, 3, 3, 3),
def test_note_feed(self): """Fetch a single note using the PFIF Atom feed.""" db.put(Person( key_name='haiti:test.google.com/person.123', subdomain='haiti', source_date=datetime.datetime(2003, 3, 3, 3, 3, 3), entry_date=datetime.datetime.utcnow(), first_name='_feed_first_name', last_name='_feed_last_name', )) db.put(No...
infos = StaticSiteMapInfo.all().fetch(2) if len(infos) > 1: logging.error("There should be at most 1 StaticSiteMapInfo record!") return None elif len(infos) == 1: return infos[0] else: query = Person.all() query.filter('last_update_date != ', None) query.order('last_update_date') person = query.get() if not person: t...
infos = StaticSiteMapInfo.all().fetch(2) if len(infos) > 1: logging.error("There should be at most 1 StaticSiteMapInfo record!") return None elif len(infos) == 1: return infos[0]
def _get_static_sitemap_info(): infos = StaticSiteMapInfo.all().fetch(2) if len(infos) > 1: logging.error("There should be at most 1 StaticSiteMapInfo record!") return None elif len(infos) == 1: return infos[0] else: #Get time of first record and set it as the sitemap generation time, this will # make the other stuff w...
time = person.last_update_date - timedelta(seconds=1) info = StaticSiteMapInfo(static_sitemaps_generation_time=time) db.put(info) return info
query = Person.all() query.filter('last_update_date != ', None) query.order('last_update_date') person = query.get() if not person: time = datetime.now() else: time = person.last_update_date - timedelta(seconds=1) info = StaticSiteMapInfo(static_sitemaps_generation_time=time) db.put(info) return info
def _get_static_sitemap_info(): infos = StaticSiteMapInfo.all().fetch(2) if len(infos) > 1: logging.error("There should be at most 1 StaticSiteMapInfo record!") return None elif len(infos) == 1: return infos[0] else: #Get time of first record and set it as the sitemap generation time, this will # make the other stuff w...
if not requested_shard_index: max_shard_index = _compute_max_shard_index(datetime.now(), then, shard_size_seconds) shards = [] for shard_index in range(max_shard_index + 1): shard = {} shard['index'] = shard_index shard['lastmod'] = format_sitemaps_datetime( then + timedelta(seconds=shard_size_seconds * (shard_index + ...
if not requested_shard_index: max_shard_index = _compute_max_shard_index( datetime.now(), then, shard_size_seconds) shards = [] for shard_index in range(max_shard_index + 1): shard = {} shard['index'] = shard_index offset_seconds = shard_size_seconds * (shard_index + 1) shard['lastmod'] = format_sitemaps_datetime( then...
def get(self): requested_shard_index = self.request.get('shard_index') sitemap_info = _get_static_sitemap_info() shard_size_seconds = sitemap_info.shard_size_seconds then = sitemap_info.static_sitemaps_generation_time
def ping_indexer(self, start_index, end_index, search_engine, status): """Pings the server with sitemap updates and returns True if all succeed""" try: for shard_index in range(start_index, end_index + 1): ping_url = self._INDEXER_MAP[search_engine] sitemap_url = ('http://' + self.domain + '/sitemap?shard_index=' + str...
def ping_indexer(self, start_index, end_index, search_engine, status): """Pings the server with sitemap updates; returns True if all succeed""" try: for shard_index in range(start_index, end_index + 1): ping_url = self._INDEXER_MAP[search_engine] sitemap_url = 'http://%s/sitemap?shard_index=%s' % ( self.domain, shard_i...
def ping_indexer(self, start_index, end_index, search_engine, status): """Pings the server with sitemap updates and returns True if all succeed""" try: for shard_index in range(start_index, end_index + 1): ping_url = self._INDEXER_MAP[search_engine] sitemap_url = ('http://' + self.domain + '/sitemap?shard_index=' + str...
self.env.language_api_key = config.get('language_api_key')
def initialize(self, *args): webapp.RequestHandler.initialize(self, *args) self.params = Struct() self.env = Struct()
<updated>2005-05-05T05:05:05Z</updated>
<updated>....-..-..T..:..:..Z</updated>
def test_note_feed(self): """Fetch a single note using the PFIF Atom feed.""" db.put(Person( key_name='haiti:test.google.com/person.123', subdomain='haiti', entry_date=datetime.datetime.utcnow(), first_name='_feed_first_name', last_name='_feed_last_name', )) db.put(Note( key_name='haiti:test.google.com/note.456', subdo...
db.put(Person(
db.put([Person(
def test_person_feed_parameters(self): """Test the max_results, skip, and min_entry_date parameters.""" db.put(Person( key_name='haiti:test.google.com/person.%d' % i, subdomain='haiti', entry_date=datetime.datetime(2000, 1, 1, i, i, i), first_name='first.%d' % i, last_name='last.%d' % i ) for i in range(1, 21)) # Crea...
) for i in range(1, 21))
) for i in range(1, 21)])
def test_person_feed_parameters(self): """Test the max_results, skip, and min_entry_date parameters.""" db.put(Person( key_name='haiti:test.google.com/person.%d' % i, subdomain='haiti', entry_date=datetime.datetime(2000, 1, 1, i, i, i), first_name='first.%d' % i, last_name='last.%d' % i ) for i in range(1, 21)) # Crea...
assert ('Missing person has been in contact with someone'
assert ('This person has been in contact with someone'
def verify_update_notes(self, found, note_body, author, **kwargs): """Verifies the process of adding a new note.
sender_domain = self.env.domain.replace(
sender_domain = self.env.parent_domain.replace(
def post(self): """If the captcha is valid, carry out the deletion. Otherwise, prompt the user with a new captcha.""" person = model.Person.get(self.subdomain, self.params.id) if not person: return self.error(400, 'No person with ID: %r' % self.params.id)
self.env.map_size_pixels = self.config.map_size_pixels
def initialize(self, *args): webapp.RequestHandler.initialize(self, *args) self.params = Struct() self.env = Struct()
if err[0] == errno.ENOTCONN:
if err[0] in (errno.ENOTCONN, errno.EINVAL):
def __init__(self, conn, server): """Initialize the command channel.
asyncore.dispatcher.__init__(self)
try: asyncore.dispatcher.__init__(self) except socket.error, err: self.close() if err[0] == errno.EINVAL: return raise
def __init__(self, cmd_channel, extmode=False): """Initialize the passive data server.
asynchat.async_chat.__init__(self, conn)
try: asynchat.async_chat.__init__(self, conn) except socket.error, err: self.close() if err[0] == errno.EINVAL: return raise
def __init__(self, conn, server): """Initialize the command channel.
self.handle_error(self)
self.handle_error()
def __init__(self, conn, server): """Initialize the command channel.
handler = self.handler(sock, self)
try: handler = self.handler(sock, self) except socket.error, err: logerror(str(err)) return
def handle_accept(self): """Called when remote client initiates a connection.""" try: sock, addr = self.accept() except TypeError: # sometimes accept() might return None (see issue 91) return except socket.error, err: # ECONNABORTED might be thrown on *BSD (see issue 105) if err[0] != errno.ECONNABORTED: logerror(trace...
self.assertRaises(Exception, auth.impersonate_user, nonexistent_user, 'pwd') self.assertRaises(Exception, auth.impersonate_user, self.get_current_user(), '')
self.assertRaises(Win32ExtError, auth.impersonate_user, nonexistent_user, 'pwd') self.assertRaises(Win32ExtError, auth.impersonate_user, self.get_current_user(), '')
def test_impersonate_user(self): auth = self.authorizer_class() nonexistent_user = self.get_nonexistent_user() try: if self.authorizer_class.__name__ == 'UnixAuthorizer': auth.impersonate_user(self.get_current_user(), '') self.assertRaises(ftpserver.AuthorizerError, auth.impersonate_user, nonexistent_user, 'pwd') else:...
user = self.get_nonexistent_user()
def test_terminate_impersonation(self): user = self.get_nonexistent_user() auth = self.authorizer_class() auth.terminate_impersonation()
try: self.authorizer_class(anonymous_user=user, anonymous_password='$|1wrongpasswd') except ftpserver.AuthorizerError, err: self.assertTrue('invalid credentials' in str(err)) else: self.fail('exception not raised')
self.assertRaises(Win32ExtError, self.authorizer_class, anonymous_user=user, anonymous_password='$|1wrongpasswd')
def test_wrong_anonymous_credentials(self): user = self.get_current_user() try: self.authorizer_class(anonymous_user=user, anonymous_password='$|1wrongpasswd') except ftpserver.AuthorizerError, err: self.assertTrue('invalid credentials' in str(err)) else: self.fail('exception not raised')
tests = [TestUnixAuthorizer]
def test_main(): test_suite = unittest.TestSuite() tests = [] warns = [] # FTPS tests if hasattr(ftplib, 'FTP_TLS'): # Added in Python 2.7 ftps_tests = [TestFTPS, TestFtpAuthenticationTLSMixin, TestTFtpDummyCmdsTLSMixin, TestFtpCmdsSemanticTLSMixin, TestFtpFsOperationsTLSMixin, TestFtpStoreDataTLSMixin, TestFtpRetrie...
try: asyncore.dispatcher.__init__(self) except socket.error, err: self.close() if err[0] == errno.EINVAL: return return self.handle_error()
asyncore.dispatcher.__init__(self)
def __init__(self, cmd_channel, extmode=False): """Initialize the passive data server.
self.cmd_channel.data_channel = handler self.cmd_channel._on_dtp_connection()
if handler.connected: self.cmd_channel.data_channel = handler self.cmd_channel._on_dtp_connection()
def handle_accept(self): """Called when remote client initiates a connection.""" try: sock, addr = self.accept() except TypeError: # sometimes accept() might return None (see issue 91) return except socket.error, err: # ECONNABORTED might be thrown on *BSD (see issue 105) if err[0] != errno.ECONNABORTED: logerror(trace...
asynchat.async_chat.__init__(self, sock_obj)
def __init__(self, sock_obj, cmd_channel): """Initialize the command channel.
data = 'abcde12345' * 100000
data = 'abcde12345' * 1000000
def test_rein_during_transfer(self): # Test REIN while already authenticated and a transfer is # in progress. self.client.login(user=USER, passwd=PASSWD) data = 'abcde12345' * 100000 self.file.write(data) self.file.close()
data = 'abcde12345' * 100000
data = 'abcde12345' * 1000000
def test_user_during_transfer(self): # Test USER while already authenticated and a transfer is # in progress. self.client.login(user=USER, passwd=PASSWD) data = 'abcde12345' * 100000 self.file.write(data) self.file.close()
data = 'abcde12345' * 100000
data = 'abcde12345' * 1000000
def test_restore_on_retr(self): data = 'abcde12345' * 100000 self.file.write(data) self.file.close()
data = 'abcde12345' * 100000
data = 'abcde12345' * 1000000
def test_abor_during_transfer(self): # Case 4: ABOR while a data transfer on DTP channel is in # progress: close data channel, respond with 426, respond # with 226. data = 'abcde12345' * 100000 f = open(TESTFN, 'w+b') f.write(data) f.close() try: self.client.voidcmd('TYPE I') conn = self.client.transfercmd('retr ' + TE...
self.respond('257 "%s" is the current directory.' %self.fs.cwd)
self.respond('257 "%s" is the current directory.' % self.fs.cwd.replace('"', '""'))
def ftp_PWD(self, line): """Return the name of the current working directory to the client.""" self.respond('257 "%s" is the current directory.' %self.fs.cwd)
ftp_handler = TLS_FTPHandler ftp_handler.certfile = 'keycert.pem' ftp_handler.authorizer = authorizer address = ('0.0.0.0', 21) ftpd = ftpserver.FTPServer(address, ftp_handler)
ftp_handler = TLS_FTPHandlerFactory('demo/keycert.pem') ftpd = ftpserver.FTPServer(('localhost', 8021), ftp_handler)
def get_context(self):
- "l" = list files (LIST, NLST, STAT, MLSD, MLST commands)
- "l" = list files (LIST, NLST, STAT, MLSD, MLST, SIZE, MDTM commands)
def add_user(self, username, password, homedir, perm='elr', msg_login="Login successful.", msg_quit="Goodbye."): """Add a user to the virtual users table.
if pwd and grp: try: uname = pwd.getpwuid(st.st_uid).pw_name except KeyError: uname = st.st_uid try: gname = grp.getgrgid(st.st_gid).gr_name except KeyError: gname = st.st_gid else: uname = "owner" gname = "group"
uname = self.get_user_by_uid(st.st_uid) gname = self.get_group_by_gid(st.st_gid)
def format_list(self, basedir, listing, ignore_err=True): """Return an iterator object that yields the entries of given directory emulating the "/bin/ls -lA" UNIX command output.
if stat.S_ISLNK(st.st_mode) and hasattr(os, 'readlink'): basename = basename + " -> " + os.readlink(file)
if stat.S_ISLNK(st.st_mode) and hasattr(self, 'readlink'): basename = basename + " -> " + self.readlink(file)
def format_list(self, basedir, listing, ignore_err=True): """Return an iterator object that yields the entries of given directory emulating the "/bin/ls -lA" UNIX command output.
ret.append(" \"*::args:_arguments\"")
ret.append(" \"*::args:_files\"")
ret.append("#compdef %s" % self.commandname)
ret.append(" ret.append("
ret.append(" ret.append(" ret.append("
ret.append("#compdef %s\n" % self.commandname)
metavar = longopt.split('=')[1] else: metavar = None
longtmp = longopt.split("=") longopt = longtmp[0] metavar = longtmp[1]
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" parser = OptionParser() helpstring_offset = 0 for cnt, line in enumerate(self.lines): if re.match("Options:", line): ## 3 == ('Options' line + version + help) helpstring_offset = self._get_helpoffset(self.lines[cnt + 1]) parseline...
option_list[option_cnt]['help'] += " " + line[helpstring_offset:]
option_list[option_cnt]['help'] += " " option_list[option_cnt]['help'] += line[helpstring_offset:]
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" parser = OptionParser() helpstring_offset = 0 for cnt, line in enumerate(self.lines): if re.match("Options:", line): ## 3 == ('Options' line + version + help) helpstring_offset = self._get_helpoffset(self.lines[cnt + 1]) parseline...
metavar = ":%s:" % action.metavar
metavar = "::%s:_files" % action.metavar
ret.append("#compdef %s" % self.commandname)
'help': line[helpstring_offset:]})
'help': line[helpstring_offset:] + ' '})
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() option_cnt = -1 option_list = [] ## 1 == 'Options' line for line in self.parselines[1:]: if '--help' in line: continue tmp = line.split() metavar = None if tmp[0][:2] == '--': ## only lon...
'metavar': None, 'help': line[helpstring_offset:]})
'metavar': metavar, 'help': help_string + ' '})
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() option_cnt = -1 option_list = [] ## 1 == 'Options' line for line in self.parselines[1:]: if '--help' in line: continue tmp = line.split() metavar = None if tmp[0][:2] == '--': ## only lon...
option_list[option_cnt]['help'] += line[helpstring_offset:]
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() option_cnt = -1 option_list = [] ## 1 == 'Options' line for line in self.parselines[1:]: if '--help' in line: continue tmp = line.split() metavar = None if tmp[0][:2] == '--': ## only lon...
help=opt['help'])
help=opt['help'].strip())
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() option_cnt = -1 option_list = [] ## 1 == 'Options' line for line in self.parselines[1:]: if '--help' in line: continue tmp = line.split() metavar = None if tmp[0][:2] == '--': ## only lon...
parser = OptionParser()
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() parser = OptionParser() option_cnt = -1 option_list = [] ## 3 == ('Options' line + version + help) for line in self.parselines[3:]: tmp = line.split() if tmp[0][:2] == '--': ## only long ...
return re.search("show program's", self.parselines[1]).start()
return re.search("show ", self.parselines[1]).start()
def _get_helpoffset(self): """get offset-position of help-strings.
for line in self.parselines[3:]:
for line in self.parselines[1:]: if '--help' in line: continue
def help2optparse(self): """convert from help strings to optparse.OptionParser object.""" helpstring_offset = self._get_helpoffset() option_cnt = -1 option_list = [] ## 3 == ('Options' line + version + help) for line in self.parselines[3:]: tmp = line.split() metavar = None if tmp[0][:2] == '--': ## only long option lo...
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 1) signal.signal(signal.SIGALRM, timeoutHandler) signal.alarm(60)
def testProfileName(self): self.assert_(self.context_client.expect("Profile.Name = QString:\"general\""))
locationString = locations[0]
if hasattr(locations, "__iter__"): locationString = locations[0] else: locationString = locations
def put(self, obj, datasetType, dataId={}, **rest): """Persists a data set given an output collection data id. @param obj the object to persist. @param datasetType the type of data set to persist. @param dataId the data id. @param **rest keyword arguments for the data id. """ dataId = sel...
os.makedirs(outDir)
try: os.makedirs(outDir) except OSError, e: if e.errno != 17: raise e
def put(self, obj, datasetType, dataId={}, **rest): """Persists a data set given an output collection data id. @param obj the object to persist. @param datasetType the type of data set to persist. @param dataId the data id. @param **rest keyword arguments for the data id. """ dataId = sel...
if __name__ == '__main__':
def run():
def testLeaks(self): memId0 = 0 nleakPrintMax = 20
func = getattr(self, 'coll_' + datasetType)
func = getattr(self, 'query_' + datasetType)
def queryMetadata(self, datasetType, key, format, dataId): """Return possible values for keys given a partial data id."""
def testGetDataSetTypes(self): self.assertEqual(set(self.mapper.getDataSetTypes()),
def testGetDatasetTypes(self): self.assertEqual(set(self.mapper.getDatasetTypes()),
def testGetDataSetTypes(self): self.assertEqual(set(self.mapper.getDataSetTypes()), set(["x", "badSourceHist"]))
format = key
format = (key,)
def queryMetadata(self, datasetType, key, format=None, dataId={}, **rest): """Returns the valid values for one or more keys when given a partial input collection data id. @param datasetType the type of data set to inquire about. @param key a key giving the level of granularity of the inquiry. @param format ...
def fileExists(self, datasetType, dataId={}, **rest):
def datasetExists(self, datasetType, dataId={}, **rest):
def fileExists(self, datasetType, dataId={}, **rest): """Determines if a data set file exists.
@returns True if the data set is file-based and exists.
@returns True if the data set exists or is non-file-based.
def fileExists(self, datasetType, dataId={}, **rest): """Determines if a data set file exists.
"fileExists() for non-file storage %s, " +
"datasetExists() for non-file storage %s, " +
def fileExists(self, datasetType, dataId={}, **rest): """Determines if a data set file exists.
return False
return True
def fileExists(self, datasetType, dataId={}, **rest): """Determines if a data set file exists.
for locationString in location.getLocations():
locations = location.getLocations() if not hasattr(locations, "__iter__"): locations = [locations] for locationString in locations:
def fileExists(self, datasetType, dataId={}, **rest): """Determines if a data set file exists.
location = self.outputMapper.map(datasetType, dataId)
location = self.mapper.map(datasetType, dataId)
def put(self, obj, datasetType, dataId={}, **rest): """Persists a data set given an output collection data id. @param obj the object to persist. @param datasetType the type of data set to persist. @param dataId the data id. @param **rest keyword arguments for the data id. """ dataId = sel...
dir = os.path.dirname(logLoc.locString()) if dir != "" and not os.path.exists(dir): os.makedirs(dir)
outDir = os.path.dirname(logLoc.locString()) if outDir != "" and not os.path.exists(outDir): os.makedirs(outDir)
def put(self, obj, datasetType, dataId={}, **rest): """Persists a data set given an output collection data id. @param obj the object to persist. @param datasetType the type of data set to persist. @param dataId the data id. @param **rest keyword arguments for the data id. """ dataId = sel...
if '__deref__' in dir(obj):
if hasattr(obj, '__deref__'):
def put(self, obj, datasetType, dataId={}, **rest): """Persists a data set given an output collection data id. @param obj the object to persist. @param datasetType the type of data set to persist. @param dataId the data id. @param **rest keyword arguments for the data id. """ dataId = sel...
self.path("fmod.dll")
if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): self.path("fmod.dll") self.end_prefix()
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'releaseSSE2/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'...
if self.prefix(src="../../libraries/i686-win32/lib/release", dst=""): self.path("openjpeg.dll") self.end_prefix()
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'releaseSSE2/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'...
if self.prefix(src=self.args['configuration'], dst=""): if self.args['configuration'] == 'Debug': self.path("msvcr80d.dll") self.path("msvcp80d.dll") self.path("Microsoft.VC80.DebugCRT.manifest") else: self.path("msvcr80.dll") self.path("msvcp80.dll") self.path("Microsoft.VC80.CRT.manifest") self.end_prefix()
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'releaseSSE2/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'...
self.path(src="%s/secondlife-bin.exe.config" % self.args['configuration'], dst=self.final_exe() + ".config")
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'releaseSSE2/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'...
if self.default_channel() and self.viewer_branding_id()=="secondlife": if self.default_grid(): installer_file = "Second_Life_%(version_dashes)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define VIEWERNAME "Second Life" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife" !define SHORTCU...
installer_file = "Singularity_%(version_short)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define VIEWERNAME "Singularity Viewer" !define INSTFLAGS "%(flags)s" !define INSTNAME "SingularityViewer" !define SHORTCUT "Singularity Viewer" !define URLNAME "singularity" !define INSTALL_ICON "inst...
def package_finish(self): # a standard map of strings for replacing in the templates substitution_strings = { 'version' : '.'.join(self.args['version']), 'version_short' : '.'.join(self.args['version'][:-1]), 'version_dashes' : '-'.join(self.args['version']), 'final_exe' : self.final_exe(), 'grid':self.args['grid'], 'g...
request.add_header('User-agent', defaultUserAgent)
if re.match("/^http:\/\/github.com/", self.url): request.add_header('User-agent', defaultUserAgent)
def fetch_local(self): #print "Looking for:",self.filename if not os.path.exists(self.filename): pass elif self.md5sum and not self._is_md5sum_match(): print "md5 mismatch:", self.filename os.remove(self.filename) else: print "Found matching package:", self.filename return print "Downloading",self.url,"to local file",s...
request.add_header('User-agent', defaultUserAgent)
if re.match("/^http:\/\/github.com/", self.url): request.add_header('User-agent', defaultUserAgent)
def do_http(self, remote): url = remote.split(':',1) if not url[1].startswith('/'): # in case it's in a homedir or something url.insert(1, '/') url.insert(0, "http://") url = ''.join(url) print "Using HTTP:",url request = urllib2.Request(url) request.add_header('User-agent', defaultUserAgent) return urllib2.urlopen(req...
self.path("paths.xml")
self.path("*.xml")
def construct(self): super(ViewerManifest, self).construct() self.exclude("*.svn*") self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg") self.path(src="../../etc/message.xml", dst="app_settings/message.xml")
self.path(self.find_existing_file('debug/secondlife-bin.exe', 'release/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'), dst=self.final_exe())
self.path(self.find_existing_file('debug/Ascent.exe', 'release/Ascent.exe', 'relwithdebinfo/Ascent.exe'), dst=self.final_exe())
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'release/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'), d...
self.path(src="%s/secondlife-bin.exe.config" % self.args['configuration'], dst=self.final_exe() + ".config")
self.path(src="%s/Ascent.exe.config" % self.args['configuration'], dst=self.final_exe() + ".config")
def construct(self): super(WindowsManifest, self).construct() # the final exe is complicated because we're not sure where it's coming from, # nor do we have a fixed name for the executable self.path(self.find_existing_file('debug/secondlife-bin.exe', 'release/secondlife-bin.exe', 'relwithdebinfo/secondlife-bin.exe'), d...
self.path("secondlife-bin","bin/"+self.binary_name())
self.path("Ascent","bin/"+self.binary_name())
def construct(self): super(LinuxManifest, self).construct() self.path("licenses-linux.txt","licenses.txt") self.path("res/"+self.icon_name(),self.icon_name()) if self.prefix("linux_tools", dst=""): self.path("client-readme.txt","README-linux.txt") self.path("client-readme-voice.txt","README-linux-voice.txt") self.path...
'--enable-osx',
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.4')
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2'
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2', 'patches/banshee-1.5.4-ige-mac-integration.patch'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.4')
(install_prefix, install_prefix, self.bundle_res_dir, files))
(self.prefix, self.prefix, self.bundle_res_dir, files))
def make_app_bundle (self): plist_path = os.path.join (self.bundle_skeleton_dir, 'Contents', 'Info.plist') app_name = 'Unknown.app' plist = None if os.path.exists (plist_path): plist = Plist.fromFile (plist_path) app_name = plist['CFBundleExecutable'] else: print 'Warning: no Contents/Info.plist in .app skeleton'
'http://getbanshee.org/~abock/%{name}-%{version}.tar.bz2'
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.3')