def build_app_command(): """Build GeoBox Python application as .exe.""" geobox_conf = config.get('appconfig') if geobox_conf: path(geobox_conf).copy(path('../app/geobox/appconfig.py')) gbi_editor = path('../app/geobox/web/static/js/gbi-editor') if gbi_editor.exists() and not gbi_editor.isdir(): print "remove gbi-editor link!" sys.exit(2) print "copying gbi-editor" if gbi_editor.exists(): gbi_editor.rmtree() path('../gbi-editor/src').copytree(gbi_editor) # insert version app_content = path('../app/geobox/app.py').bytes() app_content = re.sub(r"version = '[^']*'", "version = '%s'" % config['version'], app_content) path('../app/geobox/app.py').write_bytes(app_content) pyinstaller_spec_tpl = open(path('geobox.spec.tpl')).read() template = string.Template(pyinstaller_spec_tpl) pyinstaller_spec = path('geobox.spec') pyinstaller_spec.write_text(template.substitute(config)) call([ 'python', config['pyinstaller_dir'] / 'pyinstaller.py', pyinstaller_spec, '-y' ])
def build_installer_command(): """Build GeoBox installer.""" create_iss_config_command() config['dist_dir'].ensure_dir() call([ config['inno_dir'] / 'iscc.exe', config['build_dir'] / 'installer.iss' ])
def build_app_command(): """Build GeoBox Python application as .exe""" pyinstaller_spec_tpl = open(path('geobox.spec.tpl')).read() template = string.Template(pyinstaller_spec_tpl) pyinstaller_spec = path('geobox.spec') pyinstaller_spec.write_text(template.substitute(config)) call(['python', config['pyinstaller_dir'] / 'pyinstaller.py', pyinstaller_spec, '-y'])
def build_app_command(): """Build GeoBox Python application as .exe""" pyinstaller_spec_tpl = open(path('geobox.spec.tpl')).read() template = string.Template(pyinstaller_spec_tpl) pyinstaller_spec = path('geobox.spec') pyinstaller_spec.write_text(template.substitute(config)) call([ 'python', config['pyinstaller_dir'] / 'pyinstaller.py', pyinstaller_spec, '-y' ])
def hierarchialize(megaPartition, partitionId, partitions, numPartitions): from scriptine import shell reordering = dict() rReordering = dict() vid = 1 for (v, v_neighbors) in megaPartition: reordering[vid] = v rReordering[v] = vid vid = vid + 1 megaPartitionVertices = vid - 1 megaPartiitonEdges = 0 tempMetisInput = [] megaPartitionEdges = 0 for vid in xrange(1, megaPartitionVertices + 1): tmp = megaPartition[vid - 1][1] tmp = filter(lambda x: rReordering.has_key(x), tmp) tmp = map(lambda x: rReordering[x], tmp) megaPartitionEdges += len(tmp) tempMetisInput.append(tmp) megaPartitionEdges /= 2 tempMetisInput = [[megaPartitionVertices, megaPartitionEdges] ] + tempMetisInput tempMetisInputPath = createMetisInputFile( tempMetisInput, "tmpMetis" + str(partitionId) + ".txt") shell.call(['gpmetis', tempMetisInputPath, str(numPartitions)]) tempMetisPartitionPath = "tmpMetis" + str( partitionId) + ".txt.part." + str(numPartitions) fTempPartition = open(tempMetisPartitionPath, 'r') tempPartitions = [0] + [(( (partitionId - 1) * int(numPartitions)) + eval(x) + 1) for x in fTempPartition.readlines()] m = set() for z in tempPartitions: m.add(z) print " partitions for partition : " + str(partitionId) for z in m: print z for i in xrange(1, megaPartitionVertices + 1): partitions[reordering[i]] = tempPartitions[i]
def build_app_command(): """Build GeoBox Python application as .exe.""" geobox_conf = config.get('appconfig') if geobox_conf: path(geobox_conf).copy(path('../app/geobox/appconfig.py')) gbi_editor = path('../app/geobox/web/static/js/gbi-editor') if gbi_editor.exists() and not gbi_editor.isdir(): print "remove gbi-editor link!" sys.exit(2) print "copying gbi-editor" if gbi_editor.exists(): gbi_editor.rmtree() path('../gbi-editor/src').copytree(gbi_editor) # insert version app_content = path('../app/geobox/app.py').bytes() app_content = re.sub(r"version = '[^']*'", "version = '%s'" % config['version'], app_content) path('../app/geobox/app.py').write_bytes(app_content) pyinstaller_spec_tpl = open(path('geobox.spec.tpl')).read() template = string.Template(pyinstaller_spec_tpl) pyinstaller_spec = path('geobox.spec') pyinstaller_spec.write_text(template.substitute(config)) call(['python', config['pyinstaller_dir'] / 'pyinstaller.py', pyinstaller_spec, '-y'])
def build_installer_command(): """Build GeoBox installer.""" create_iss_config_command() config['dist_dir'].ensure_dir() call([config['inno_dir'] / 'iscc.exe', config['build_dir'] / 'installer.iss'])
def metis_command(inputPath, numPartitions1, numPartitions2): print "call to metis_command with args:" print "inputPath :" + str(inputPath) print "numpartitions1 :" + str(numPartitions1) print "numpartitions2 :" + str(numPartitions2) # time.sleep(120) from scriptine import shell if int(numPartitions1) > 1: print "calling metis " + " shell.call(['gpmetis',inputPath,str(numPartitions1)]) " print "Args : inputpath " + str(inputPath) print "Args : numPartitions1 " + str(numPartitions1) print "Args : numPartitions2 " + str(numPartitions2) shell.call(['gpmetis', inputPath, str(numPartitions1)]) else: print "else part in metis_command called with args : " print "inputPath " + str(inputPath) print "numPart1 " + str(numPartitions1) print "numPart2 " + str(numPartitions2) #time.sleep(20) tmpFile = open(inputPath + '.part.1', 'w') print "created a tmp file " + str(tmpFile) + " original file " + str( inputPath) # z=raw_input()()() origFile = open(inputPath) first_line = origFile.read().strip().split() vertices = int(first_line[0]) for v in xrange(vertices): tmpFile.write('0\n') tmpFile.close() origFile.close() # time.sleep(30) print inputPath + '.part.1' print "check input path again with lines equal no of vertices " #z=raw_input()() partitionPath = inputPath + '.part.' + str(numPartitions1) fPartition = open(partitionPath, 'r') print " executing commnd partitions = [0] + [eval(x)+1 for x in fPartition.readlines()] with fpartitions at " + str( partitionPath) # time.sleep(20) #z=raw_input()() partitions = [0] + [eval(x) + 1 for x in fPartition.readlines()] print "after execution of commnand partitions: " # for z in range(10): # print str(partitions[z]) print " input path is " + str( inputPath) + " executing command fMetisInput = open(inputPath, 'r')" fMetisInput = open(inputPath, 'r') metisInput = [[int(a) for a in x.strip().split()] for x in fMetisInput.readlines()] print "after execution of commnand metisInput = [[int(a) for a in x.strip().split()] for x in fMetisInput.readlines()] : " megaPartitions = defaultdict(list) print "after execution of commnand megaPartitions = defaultdict(list) : " for i in xrange(1, len(metisInput)): megaPartitions[partitions[i]].append((i, metisInput[i])) for q in megaPartitions: print megaPartitions[q] print "after execution of for loop : " #z=raw_input()() # time.sleep(10) for i in xrange(1, int(numPartitions1) + 1): print "calling hierarchialize(megaPartitions[i],i,partitions,numPartitions2) with megaPartitions[i]: " + "partitions " + " part2: " + str( numPartitions2) #z=raw_input()() hierarchialize(megaPartitions[i], i, partitions, numPartitions2) partitionFilePath = inputPath + ".part." + str( int(numPartitions1) * int(numPartitions2)) print "partitionFilePath: " + partitionFilePath print numPartitions1 print numPartitions2 #z=raw_input()() # time.sleep(50) print "calling generateNewPartitions(partitions, partitionFilePath) with args partitions " + str( partitions) + " partitionFilePath " + str(partitionFilePath) generateNewPartitions(partitions, partitionFilePath)