def save_app_to_list(appslist): cc = 0 date = utils.getdate() #if len(appslist) > 0: # print appslist[0].category for i in appslist: i.package = utils.get_package(i.link) app = db.search_partappinfo(i.package) dev = db.search_developer(i.company, i.package) cc += 1 if dev is None: #maybe this package is not relative with dev. pass else: db.update_devinfo(dev.company, date, dev.status, i.package, i.company, i.company_link) #if dev is not None and cmp(dev.date, date) != 0: # print "update dev:", i.company, i.company_link, dev.date, date if app is None: db.write_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) else: i.date = date db.check_append_appchangelog_info(i, app) db.update_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small)
def create_project_file(config): """ Creates a coregen project with settings for this device Args: config (dictionary): configuration dictionary Returns: (string): filename to the project file Raises: Nothing """ core_dir = get_coregen_dir(config, absolute=True) cp_fn = os.path.join(core_dir, COREGEN_PROJECT_NAME) fp = open(cp_fn, "w") #Open up the template dictionary fn = COREGEN_TEMPLATE fn = os.path.join(os.path.dirname(__file__), fn) template = json.load(open(fn, "r")) template["device"] = utils.get_device(config) template["devicefamily"] = utils.get_family(config) template["package"] = utils.get_package(config) template["speedgrade"] = utils.get_speed_grade(config) template["workingdirectory"] = get_coregen_temp_dir(config, absolute=True) for t in template: fp.write("SET %s = %s%s" % (t, template[t], os.linesep)) fp.close() return cp_fn
def create_project_file(config): """ Creates a coregen project with settings for this device Args: config (dictionary): configuration dictionary Returns: (string): filename to the project file Raises: Nothing """ core_dir = get_coregen_dir(config, absolute = True) cp_fn = os.path.join(core_dir, COREGEN_PROJECT_NAME) fp = open(cp_fn, "w") #Open up the template dictionary fn = COREGEN_TEMPLATE fn = os.path.join(os.path.dirname(__file__), fn) template = json.load(open(fn, "r")) template["device"] = utils.get_device(config) template["devicefamily"] = utils.get_family(config) template["package"] = utils.get_package(config) template["speedgrade"] = utils.get_speed_grade(config) template["workingdirectory"] = get_coregen_temp_dir(config, absolute = True) for t in template: fp.write("SET %s = %s%s" % (t, template[t], os.linesep)) fp.close() return cp_fn
def collect_all_apps(): urlGen = UrlGen() allCategories = urlGen.get_test_categories() appsList = parseapp.parse_all_apps(allCategories, None) cc = 0 for i in appsList: i.package = utils.get_package(i.link) app = db.search_partappinfo(i.package) dev = db.search_developer(i.company, i.package) cc = cc + 1 if dev is None: #maybe this package is not relative with dev. pass else: db.update_devinfo(dev.company, utils.getdate(), dev.status, i.package, i.company, i.company_link) #print i.package if app is None: db.write_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) else: i.date = utils.getdate() db.check_append_appchangelog_info(i, app) db.update_appinfo(i.rank, i.title, i.package, i.link, i.company, i.company_link, i.desc, utils.getdate(), i.category, i.icon, i.icon_small) return appsList
def main(): output, repo, domain = get_arguments() archive = 'https://{0}/{1}/archive/master.zip'.format(domain, repo) time_format = datetime.now().strftime('%Y-%m-%d_%H.%M.%S') utils.LOG.info('Starting repository analysis...') output = output + '/' + repo.replace('/','_') + '-' + time_format utils.get_package(archive, output) feature_files = utils.get_feature_files(output) tag_ojb_list = utils.parse_files(feature_files) utils.stats_output(tag_ojb_list) utils.LOG.info('Finished...')
def run(self, edit): folder=utils.get_folder() self.archivos=[] self.explore(folder) ruta="" for archivo in self.archivos: if archivo.endswith(".apk"): ruta=archivo break if not ruta: sublime.status_message("no hay nada para desplegar") os.chdir(folder) comando='gradle build && exit' print(comando) archivo=open(sublime.packages_path()+os.sep+"start.cmd", "w") archivo.write(comando) archivo.close() os.system("start /min "+sublime.packages_path()+os.sep+"start.cmd") return filename=os.path.basename(ruta) os.chdir(folder) d={"filepath":ruta} d["package"]=package=utils.get_package() d["classname"]=utils.get_filebasename() # if d["package"]:comando='gradle build && adb install -r %(filepath)s && adb shell am start -n %(package)s/%(package)s.%(classname)s && exit'%d # else:comando='gradle build && adb install -r %(filepath)s && exit'%d if d["package"]:comando='adb install -r %(filepath)s && adb shell am start -n %(package)s/%(package)s.%(classname)s && exit'%d else:comando='adb install -r %(filepath)s && exit'%d print(comando) archivo=open(sublime.packages_path()+os.sep+"start.cmd", "w") archivo.write(comando) archivo.close() os.system("start /min "+sublime.packages_path()+os.sep+"start.cmd")
def test_get_package(self): config = utils.read_config(self.env) config["device"] = "xc6slx9-tqg144-3" package = utils.get_package(config) self.assertEqual("tqg144", package)
def customize_core(config, coregen_filename): """ Reads in the xco from the the core directory and customize it for this Architecture Args: config (dictionary): configuration dictionary coregen_filename (string): filename of the coregen file to work on Returns: (string): filename to the custom core path Raises: Nothing """ #Open the coregen file fp = open(coregen_filename) core_in = fp.read() fp.close() #open a reference to the output file c_fn = os.path.split(coregen_filename)[1] c_fn = os.path.join(get_coregen_dir(config, absolute = True), c_fn) #Open up the template dictionary fn = COREGEN_TEMPLATE fn = os.path.join(os.path.dirname(__file__), fn) template = json.load(open(fn, "r")) template["device"] = utils.get_device(config) template["devicefamily"] = utils.get_family(config) template["package"] = utils.get_package(config) template["speedgrade"] = utils.get_speed_grade(config) template["workingdirectory"] = get_coregen_temp_dir(config, absolute = True) #print "Open: %s" % c_fn fp = open(c_fn, "w") #Break this into lines core_in_lines = core_in.splitlines() for line in core_in_lines: line = line.strip() if re.search('BEGIN.*Project.*Options', line, re.I): #print "\tFound the beginning of the project" fp.write("%s%s" % (line, os.linesep)) #Copy all the objects into the new file for key in template: fp.write("SET %s = %s%s" % (key, template[key], os.linesep)) continue if "CRC" in line: #Don't write the CRC continue #if line.startswith("#"): #print "line: %s" % line items = line.split(' ') if "set" == items[0].lower(): #print "Line: %s" % line #Now we have a line we might need to modify if items[1].lower() in template.keys(): #Skip it, cause we already wrote what we wanted into the new xco continue fp.write("%s%s" % (line, os.linesep)) fp.close()
def customize_core(config, coregen_filename): """ Reads in the xco from the the core directory and customize it for this Architecture Args: config (dictionary): configuration dictionary coregen_filename (string): filename of the coregen file to work on Returns: (string): filename to the custom core path Raises: Nothing """ #Open the coregen file fp = open(coregen_filename) core_in = fp.read() fp.close() #open a reference to the output file c_fn = os.path.split(coregen_filename)[1] c_fn = os.path.join(get_coregen_dir(config, absolute=True), c_fn) #Open up the template dictionary fn = COREGEN_TEMPLATE fn = os.path.join(os.path.dirname(__file__), fn) template = json.load(open(fn, "r")) template["device"] = utils.get_device(config) template["devicefamily"] = utils.get_family(config) template["package"] = utils.get_package(config) template["speedgrade"] = utils.get_speed_grade(config) template["workingdirectory"] = get_coregen_temp_dir(config, absolute=True) #print "Open: %s" % c_fn fp = open(c_fn, "w") #Break this into lines core_in_lines = core_in.splitlines() for line in core_in_lines: line = line.strip() if re.search('BEGIN.*Project.*Options', line, re.I): #print "\tFound the beginning of the project" fp.write("%s%s" % (line, os.linesep)) #Copy all the objects into the new file for key in template: fp.write("SET %s = %s%s" % (key, template[key], os.linesep)) continue if "CRC" in line: #Don't write the CRC continue #if line.startswith("#"): #print "line: %s" % line items = line.split(' ') if "set" == items[0].lower(): #print "Line: %s" % line #Now we have a line we might need to modify if items[1].lower() in template.keys(): #Skip it, cause we already wrote what we wanted into the new xco continue fp.write("%s%s" % (line, os.linesep)) fp.close()
return 0 # Task status: FINISHED task_info = { 'entity_id': pkg_data['id'], 'entity_type': u'package', 'task_type': u'upload_rdf', 'key': u'celery_task_status', 'value': u'%s - %s' % ('FINISHED', unicode(upload_rdf.request.id)), 'error': u'', 'last_updated': datetime.now().isoformat() } update_task_status(task_info) try: pkg = get_package(pkg_data['id']) for res in pkg['resources']: if 'generated_by_ckanextsparql' in res and res['generated_by_ckanextsparql']: res['last_modified'] = datetime.now().isoformat() update_resource(res) break except: print 'Unable to update last_modified' return 1 @periodic_task(run_every=periodicity) def dataset_rdf_crawler(): # Task status: RUNNING task_info = { 'entity_id': 'GLOBAL',