def create_project(argv): names, type_names = _get_names(argv) os.chdir(names.quickly_name) _create_project(names, type_names) try: os.mkdir("m4") except OSError: pass pandoramacros.copy_pandora_files() try: os.chmod("config/autorun.sh", 0755) os.chmod("config/pandora-plugin", 0755) os.chmod("config/config.rpath", 0755) os.chmod("test_run.sh", 0755) except: pass pandora_version = pandoramacros.get_pandora_version() licensing.licensing("GPL-3") configurationhandler.loadConfig() configurationhandler.project_config['project-type'] = type_names.project_name configurationhandler.project_config['pandora-version'] = pandora_version configurationhandler.saveConfig()
def link_project(launchpad, question, lp_project_name=None): ''' Link to launchpad project, erasing previous one if already set :return project object''' # if config not already loaded if not configurationhandler.project_config: configurationhandler.loadConfig() if not lp_project_name: choice = "0" while choice == "0": lp_id = raw_input("%s, leave blank to abort.\nLaunchpad project name: " % question) if lp_id == "": raise launchpad_project_error(_("No launchpad project given, aborting.")) prospective_projects = launchpad.projects.search(text=lp_id) project_number = 1 project_names = [] for project in prospective_projects: print (_('''---------------- [%s] ---------------- %s -------------------------------------- Project name: %s Launchpad url: %s/%s %s ''') % (project_number, project.title, project.display_name, launchpad_url, project.name, project.summary)) project_names.append(project.name) project_number += 1 if not list(prospective_projects): message = _("No project found") else: message = _("Choose your project number") choice = raw_input("%s, leave blank to abort, 0 for another search.\nYour choice: " % message) try: choice = int(choice) if choice in range(1, project_number): project = launchpad.projects[project_names[choice - 1]] else: raise ValueError except ValueError: raise launchpad_project_error(_("No right number given, aborting.")) # we got a project name, check that it exists else: try: project = launchpad.projects[lp_project_name] except KeyError: raise launchpad_project_error(_("Can't find %s project on Launchpad. You can try to find it interactively without providing a project name.") % lp_project_name) configurationhandler.project_config['lp_id'] = project.name configurationhandler.saveConfig() return project
("project_name",names.project_name), ("camel_case_name",names.camel_case_name), ("sentence_name",names.sentence_name), ("all_caps_name",names.all_caps_name), ) new_file_list = pandoramacros.copy_pandora_files() new_pandora_version = pandoramacros.get_pandora_version() try: os.chmod("config/autorun.sh", 0755) os.chmod("config/pandora-plugin", 0755) os.chmod("config/config.rpath", 0755) os.chmod("test_run.sh", 0755) except: pass configurationhandler.project_config['pandora-version'] = new_pandora_version configurationhandler.saveConfig() vc.add_and_commit(new_file_list) # Remove AC_CONFIG_HEADERS and AC_CONFIG_MACRO_DIR from configure.ac if project_version < '0.99': pass sys.exit(0)
source_dir = os.path.join(os.path.dirname(__file__), 'project_root', 'python') templatetools.file_from_template(source_dir, "helpers.py", python_name, substitutions) if project_version < '0.4.3': ## update dependencies format if 'dependencies' in configurationhandler.project_config \ and not ',' in configurationhandler.project_config['dependencies']: dependencies = [elem for elem in configurationhandler.project_config['dependencies'].split(' ') if elem] configurationhandler.project_config['dependencies'] = ", ".join(dependencies) configurationhandler.saveConfig() if project_version < '0.4.4': # Use full modelines for all python files sedline = "sed -i 's/-\*- coding: utf-8 -\*-/-*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-/'" os.system("find . -name '*.py' -exec %s {} \;" % sedline) os.system("%s bin/%s" % (sedline, project_name)) ### 11.03 update if project_version < '11.03': # support /opt installation content_to_update = '''python_path = [] if os.path.abspath(__file__).startswith('/opt'): syspath = sys.path[:] # copy to avoid infinite loop in pending objects for path in syspath: opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/%(project_name)s')
def link_project(launchpad, question, lp_project_name=None): ''' Link to launchpad project, erasing previous one if already set :return project object''' # if config not already loaded if not configurationhandler.project_config: configurationhandler.loadConfig() if not lp_project_name: choice = "0" while choice == "0": lp_id = raw_input( "%s, leave blank to abort.\nLaunchpad project name: " % question) if lp_id == "": raise launchpad_project_error( _("No launchpad project given, aborting.")) prospective_projects = launchpad.projects.search(text=lp_id) project_number = 1 project_names = [] for project in prospective_projects: print( _('''---------------- [%s] ---------------- %s -------------------------------------- Project name: %s Launchpad url: %s/%s %s ''') % (project_number, project.title, project.display_name, launchpad_url, project.name, project.summary)) project_names.append(project.name) project_number += 1 if not list(prospective_projects): message = _("No project found") else: message = _("Choose your project number") choice = raw_input( "%s, leave blank to abort, 0 for another search.\nYour choice: " % message) try: choice = int(choice) if choice in range(1, project_number): project = launchpad.projects[project_names[choice - 1]] else: raise ValueError except ValueError: raise launchpad_project_error( _("No right number given, aborting.")) # we got a project name, check that it exists else: try: project = launchpad.projects[lp_project_name] except KeyError: raise launchpad_project_error( _("Can't find %s project on Launchpad. You can try to find it interactively without providing a project name." ) % lp_project_name) configurationhandler.project_config['lp_id'] = project.name configurationhandler.saveConfig() return project