def main(): args = parse_arguments() config_path = args.config_file or utils.app_path(DEFAULT_CONFIG_FILE) config = json.load(open(config_path)) bench_configs = config['benchmarks'] bench = benchmark.Bench(config, args) bench.start()
def __init__(self, config, hash_key=""): """ Initialize an EastwindPackage for install/dump config: path to config file """ self.config = EastwindSet(os.path.expanduser(config)) if hash_key == "": self.hash = utils.hash_name(self.config.name) else: self.hash = hash_key self.base_path = utils.app_path(os.path.join("package", self.hash, "")) self.config_manager = EastwindConfigManager(self.base_path) self.pkg_manager = EastwindPkgManager()
def extract(self, pkg_path): """ Extracting an EastwindPackage and turn it to a instance pkg_path: path to EastwindPackage, will expanded to user path """ self.pkg_name = os.path.basename(pkg_path) tar = tarfile.open(os.path.expanduser(pkg_path), "r:gz") hash_name = utils.hash_name(pkg_path) dest_dir = utils.app_path(os.path.join("package", hash_name)) tar.extractall(dest_dir) tar.close() config_file = os.path.join(dest_dir, "control") return EastwindPackage(config_file, hash_name)
def run_degrel(*args): if not args: args = utils.args() os.chdir(utils.APP_DIR) try: project_classes = glob.glob( app_path('target', 'scala-*', 'classes'))[-1] except: print('Project classes not found in targets/scala-*/classes', file=sys.stderr) sys.exit(-1) classpath = project_classes + PATH_ITEM_SEP + dependency_classpath() return run('java', '-cp', quote(classpath), MAIN_CLASS, *args)
def init_gui(self): # win initialisations self.layout = QtWidgets.QGridLayout() self.window = QtWidgets.QWidget() self.window.setLayout(self.layout) self.setCentralWidget(self.window) self.setWindowTitle('Products') self.setWindowIcon(QtGui.QIcon(app_path('pics/icon.png'))) self.view_product_widget = ViewProduct() self.add_product_widget = AddProduct(self.view_product_widget) self.edit_product_widget = EditProduct(self.view_product_widget) self.delete_product_widget = DeleteProduct(self.view_product_widget) layout_addWidget(self.layout, [ (self.add_product_widget, 0, 0), (self.edit_product_widget, 0, 1), (self.delete_product_widget, 0, 2), (self.view_product_widget, 0, 3), ])
#!/usr/bin/env python from __future__ import print_function import sys import glob import os from utils import app_path, run, system, quote import utils import platform CLASSPATH_CACHE = app_path('.sbt-classpath') MAIN_CLASS = 'degrel.Main' BUILD_SBT = app_path('build.sbt') if platform.system() == 'Windows': PATH_ITEM_SEP = ';' SBT_EXPORT_DEPS_COMMAND = ['sbt', 'export compile:dependency-classpath'] else: PATH_ITEM_SEP = ':' SBT_EXPORT_DEPS_COMMAND = ['sbt "export compile:dependency-classpath"'] def dependency_classpath(): """ Fetch project classpath form sbt, and cache in ".sbt-classpath" file if mtime of "build.sbt" is newer than """ if os.path.exists(CLASSPATH_CACHE) and\
import sys import os from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from utils import app_path engine = create_engine('sqlite:///{}'.format(app_path('db/items.db'))) Session = sessionmaker(bind=engine) Base = declarative_base()