def generate_project(self): '''Generates project.''' print "generating project" from saplib import saplib import saputils if self.bc.is_running(): return saplib.generate_project(self.filename) current_dir = os.getcwd() project_dir = self.sc.get_project_location() p = saputils.resolve_linux_path(project_dir) print "project_dir: " + p os.chdir(p) self.bc.run("pa_no_gui.sh") # out = subprocess.call(["bash", "./pa_no_gui.sh"]) # self.build_thread = build_controller.buildThread( 1, # "Build Thread", # p) # self.build_thread.start() os.chdir(current_dir) gobject.timeout_add(50, self.build_tick) self.status.print_info(__file__, "started build thread")
def generate_project(self): """Generates the output project that can be used to create a bit image.""" self.save_config_file(self.filename) try: saplib.generate_project(self.filename) except IOError as err: print "File Error: " + str(err)
def main(argv): sys.path.append(sys.path[0] + '/saplib') sys.path.append(sys.path[0] + '/saplib/gen_scripts') os.environ["SAPLIB_BASE"] = sys.path[0] + "/saplib" compress = False if (len(argv) == 0): usage() sys.exit(1) else: try: opts, args = getopt.getopt( argv, "hvdco:", ["help", "verbose", "debug", "compress", "outfile"]) except getopt.GetoptError, err: print(err) usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): usage() sys.exit() elif opt in ("-v", "--verbose"): print "Verbose flag enabled" global _verbose _verbose = True elif opt in ("-d", "--debug"): print "Debug flag enabled" global _debug _debug = True elif opt in ("-c", "--compress"): print "Compress output, tgz" compress = True elif opt in ("-o", "--output"): output_filename = arg print "Output filename: " + output_filename if (len(args) == 0): print "" print "no input file to process" usage() sys.exit(1) else: for filename in args: if _verbose: print "processing " + filename saplib.generate_project(filename)
def main(argv): sys.path.append(sys.path[0] + '/saplib') sys.path.append(sys.path[0] + '/saplib/gen_scripts') os.environ["SAPLIB_BASE"] = sys.path[0] + "/saplib" compress = False if (len(argv) == 0): usage() sys.exit(1) else: try: opts, args = getopt.getopt(argv, "hvdco:", ["help", "verbose", "debug", "compress", "outfile"]) except getopt.GetoptError, err: print (err) usage() sys.exit(2) for opt, arg in opts: if opt in ("-h", "--help"): usage() sys.exit() elif opt in ("-v", "--verbose"): print "Verbose flag enabled" global _verbose _verbose = True elif opt in ("-d", "--debug"): print "Debug flag enabled" global _debug _debug = True elif opt in ("-c", "--compress"): print "Compress output, tgz" compress = True elif opt in ("-o", "--output"): print "Output filename: " + output_filename output_filename = arg if (len(args) == 0): print "" print "no input file to process" usage() sys.exit(1) else: for filename in args: if _verbose: print "processing " + filename saplib.generate_project(filename)
def test_generate_project(self): filename = os.getenv("SAPLIB_BASE") + "/example_project/gpio_v2.json" result = saplib.generate_project(filename) self.assertEqual(result, True)