path_and_project = sys.argv[1].split('/') project_name = path_and_project[-1] try: project_name = templatetools.quickly_name(project_name) except: # user friendly message already caught in pre_create sys.exit(1) if len(path_and_project) > 1: os.chdir(str(os.path.sep).join(path_and_project[0:-1])) os.chdir(project_name) templatetools.copy_dirs_from_template() # add it to revision control print _("Creating bzr repository and committing") bzr_instance = subprocess.Popen(["bzr", "init"], stdout=subprocess.PIPE) bzr_instance.wait() bzr_instance = subprocess.Popen(["bzr", "add"], stdout=subprocess.PIPE) bzr_instance.wait() bzr_instance = subprocess.Popen(["bzr", "commit", "-m", "Initial project creation with Quickly!"], stderr=subprocess.PIPE) env = os.environ.copy() # Compile schema if present schemapath = os.path.abspath("data/glib-2.0/schemas") if os.path.exists(schemapath): subprocess.call(["glib-compile-schemas", schemapath])
"s|^import gettext$|import locale|g;" + \ "s|^from gettext import |from locale import |g;" + \ "s|^gettext.textdomain|locale.textdomain|g;" + \ "'" # This find only hits the main module, and that is fine, other files will # be updated by normal overwriting mechanism below. os.system("find %s -name '*.py' -exec %s {} \;" % (python_name, sedline)) # Overwrite quickly-owned files as necessary if project_version < template_version: print _( """Note: This is the first time you have run Quickly since it has been updated. Quickly will now upgrade its files (bin/*, %s_lib/*, and setup.py). But first it will save your project. View Quickly's changes by running: bzr diff""" % python_name) subprocess.call(["bzr", "add", "-q"]) subprocess.call( ["bzr", "commit", "--unchanged", "-q", "-m", "Pre-upgrade checkpoint"]) templatetools.copy_dirs_from_template(dirs=['bin', 'python_lib']) templatetools.copy_setup_py_from_template() try: # License new files as needed license.licensing() except license.LicenceError as e: pass # Don't worry about it, user may not have set it up yet subprocess.call(["bzr", "add", "-q"]) # bzr diff will show new files templatetools.update_version_in_project_file(template_version, 'ubuntu-application') sys.exit(0)
path_and_project = sys.argv[1].split('/') project_name = path_and_project[-1] try: project_name = templatetools.quickly_name(project_name) except: # user friendly message already caught in pre_create sys.exit(1) if len(path_and_project) > 1: os.chdir(str(os.path.sep).join(path_and_project[0:-1])) os.chdir(project_name) templatetools.copy_dirs_from_template() # add it to revision control print _("Creating bzr repository and committing") bzr_instance = subprocess.Popen(["bzr", "init"], stdout=subprocess.PIPE) bzr_instance.wait() bzr_instance = subprocess.Popen(["bzr", "add"], stdout=subprocess.PIPE) bzr_instance.wait() bzr_instance = subprocess.Popen( ["bzr", "commit", "-m", "Initial project creation with Quickly!"], stderr=subprocess.PIPE) env = os.environ.copy() # Compile schema if present schemapath = os.path.abspath("data/glib-2.0/schemas") if os.path.exists(schemapath):
os.chdir(project_name) # Calculate the SWF's dimensions try: width, height = SWF.dimensions(swf) except SWF.SWFNotASWF: print "File '%s' does not seem to be a SWF. Terminating." sys.exit(7) except SWF.SWFNoDimensions: print "(Could not read size from SWF file; defaulting to 640x480. You should edit bin/%s with the correct size.)" % project_name width, height = (640, 480) substitutions = [("swf_height",str(height)), ("swf_width",str(width))] templatetools.copy_dirs_from_template(extra_substitutions = substitutions) # set the mode to executable for executable file exec_file = os.path.join('bin', project_name) try: os.chmod(exec_file, 0755) except: pass # Copy the specified SWF file into the project shutil.copyfile(swf, os.path.join("data", "game.swf")) # We require a specific version of the ubuntu-application template, so # edit the project's .quickly file to specify it. #WORKAROUND fp = open(".quickly", "a")