text
stringlengths
0
828
self.directory.install_directory(self.feature_name),
remove_common_prefix=True)
bin_path = os.path.join(self.directory.install_directory(self.feature_name), 'bin')
if os.path.exists(bin_path):
for f in os.listdir(bin_path):
self.directory.symlink_to_bin(f, os.path.join(bin_path, f))
return True"
1294,"def __write_p4settings(self, config):
"""""" write perforce settings """"""
self.logger.info(""Writing p4settings..."")
root_dir = os.path.expanduser(config.get('root_path'))
p4settings_path = os.path.join(root_dir, "".p4settings"")
if os.path.exists(p4settings_path):
if self.target.get('overwrite_p4settings', False):
self.logger.info(""Overwriting existing p4settings..."")
os.remove(p4settings_path)
else:
return
with open(p4settings_path, ""w+"") as p4settings_file:
p4settings_file.write(p4settings_template % config.to_dict())
if config.get('write_password_p4settings', 'no'):
p4settings_file.write(""\nP4PASSWD=%s"" % config['password'])"
1295,"def __configure_client(self, config):
"""""" write the perforce client """"""
self.logger.info(""Configuring p4 client..."")
client_dict = config.to_dict()
client_dict['root_path'] = os.path.expanduser(config.get('root_path'))
os.chdir(client_dict['root_path'])
client_dict['hostname'] = system.NODE
client_dict['p4view'] = config['p4view'] % self.environment.target.get_context_dict()
client = re.sub('//depot', ' //depot', p4client_template % client_dict)
self.logger.info(lib.call(""%s client -i"" % self.p4_command,
stdin=client,
env=self.p4environ,
cwd=client_dict['root_path']))"
1296,"def __install_eggs(self, config):
"""""" Install eggs for a particular configuration """"""
egg_carton = (self.directory.install_directory(self.feature_name),
'requirements.txt')
eggs = self.__gather_eggs(config)
self.logger.debug(""Installing eggs %s..."" % eggs)
self.__load_carton(egg_carton, eggs)
self.__prepare_eggs(egg_carton, config)"
1297,"def __add_paths(self, config):
"""""" add the proper resources into the environment """"""
bin_path = os.path.join(self.directory.install_directory(self.feature_name), 'bin')
whitelist_executables = self._get_whitelisted_executables(config)
for f in os.listdir(bin_path):
for pattern in BLACKLISTED_EXECUTABLES:
if re.match(pattern, f):
continue
if whitelist_executables and f not in whitelist_executables:
continue
self.directory.symlink_to_bin(f, os.path.join(bin_path, f))"
1298,"def analyse_body_paragraph(body_paragraph, labels=None):
""""""Analyse commit body paragraph and return (label, message).
>>> analyse_body_paragraph('* BETTER Foo and bar.',
>>> ... {'BETTER': 'Improvements'})
('BETTER', 'Foo and bar.')
>>> analyse_body_paragraph('* Foo and bar.')
(None, 'Foo and bar.')
>>> analyse_body_paragraph('Foo and bar.')
(None, None)
""""""
# try to find leading label first:
for label, dummy in labels:
if body_paragraph.startswith('* ' + label):
return (label, body_paragraph[len(label) + 3:].replace('\n ',
' '))
# no conformed leading label found; do we have leading asterisk?
if body_paragraph.startswith('* '):
return (None, body_paragraph[2:].replace('\n ', ' '))
# no leading asterisk found; ignore this paragraph silently:
return (None, None)"
1299,"def remove_ticket_directives(message):
""""""Remove ticket directives like ""(closes #123).
>>> remove_ticket_directives('(closes #123)')
'(#123)'
>>> remove_ticket_directives('(foo #123)')
'(foo #123)'
""""""
if message:
message = re.sub(r'closes #', '#', message)
message = re.sub(r'addresses #', '#', message)
message = re.sub(r'references #', '#', message)
return message"
1300,"def amended_commits(commits):
""""""Return those git commit sha1s that have been amended later.""""""
# which SHA1 are declared as amended later?
amended_sha1s = []
for message in commits.values():
amended_sha1s.extend(re.findall(r'AMENDS\s([0-f]+)', message))
return amended_sha1s"
1301,"def enrich_git_log_dict(messages, labels):
""""""Enrich git log with related information on tickets.""""""
for commit_sha1, message in messages.items():