

def _update_python_services(package_path):
    service_file_regexp = re.compile('(?:.*\\s)?(.*?\\.pyc)\\b')
    manifest_path = os.path.join(package_path, 'manifest.xml')
    tree = qisys.qixml.read(manifest_path)
    root = tree.getroot()
    services = root.findall('services/service')
    for service in services:
        exec_start = service.attrib['execStart']
        exec_start = re.sub('.py\\b', '.pyc', exec_start)
        match_object = service_file_regexp.match(exec_start)
        if (match_object is None):
            continue
        service_file_path = match_object.group(1)
        if os.path.exists(os.path.join(package_path, service_file_path)):
            service.set('execStart', exec_start)
    qisys.qixml.write(tree, manifest_path, encoding='utf-8')

dataset/ETHPy150Open aldebaran/qibuild/python/qipkg/release.py _update_python_services/original