def export(args): # load data repo = Repository(args.repo) dbs = {} license = LICENSES_SHORT[args.license] out_path = os.path.join(repo.path, "output", args.target) if args.target == "openscad": dbs["openscad"] = OpenSCADData(repo) from backends.openscad import OpenSCADBackend OpenSCADBackend(repo, dbs).write_output( out_path, target_license=license, version="development", expand=args.debug ) copyfile( os.path.join(repo.path, "backends", "licenses", args.license.strip("+")), os.path.join(out_path, "LICENSE") ) elif args.target == "freecad": dbs["freecad"] = FreeCADData(repo) from backends.freecad import FreeCADBackend FreeCADBackend(repo, dbs).write_output( out_path, target_license=license, version="development" ) copyfile( os.path.join(repo.path, "backends", "licenses", args.license.strip("+")), os.path.join(out_path, "BOLTS", "LICENSE") ) elif args.target == "pythonpackage": dbs["pythonpackage"] = PythonPackageData(repo) from backends.pythonpackage import PythonPackageBackend PythonPackageBackend(repo, dbs).write_output( out_path, target_license=license, version="development" ) # elif args.target == "solidworks": # dbs["solidworks"] = SolidWorksData(repo) # from backends.solidworks import SolidWorksBackend # SolidWorksBackend(repo,dbs).write_output(out_path,"development") elif args.target == "iges": from backends.exchange import IGESBackend IGESBackend(repo, dbs).write_output(out_path, "development") elif args.target == "website": dbs["drawings"] = DrawingsData(repo) dbs["freecad"] = FreeCADData(repo) dbs["openscad"] = OpenSCADData(repo) from backends.webpage import WebsiteBackend WebsiteBackend(repo, dbs).write_output(out_path) elif args.target == "drawings": dbs["drawings"] = DrawingsData(repo)
def release(args): #check that there are no uncommited changes if call(["git", "diff", "--exit-code", "--quiet"]) == 1: print "There are uncommited changes present in the git repository. Please take care of them before releasing" exit(1) if args.kind == "stable" and args.version is None: print "Please specify a version using -v when releasing a stable version" exit(2) if args.kind == "development" and not args.version is None: print "No explicit version can be given for development releases" exit(2) repo = BOLTSRepository(args.repo) version = datetime.now().strftime("%Y%m%d%H%M") stable = args.kind == "stable" if stable: version = args.version from backends.openscad import OpenSCADExporter from backends.freecad import FreeCADExporter dbs = {} dbs["openscad"] = OpenSCADData(args.repo) dbs["freecad"] = FreeCADData(args.repo) #export for li_short in ["lgpl2.1+", "gpl3"]: license = LICENSES_SHORT[li_short] OpenSCADExporter(repo, dbs).write_output( os.path.join(repo.path, "output", "openscad"), license, version, stable) copyfile( os.path.join(repo.path, "backends", "licenses", li_short.strip("+")), os.path.join(repo.path, "output", "openscad", "LICENSE")) FreeCADExporter(repo, dbs).write_output( os.path.join(repo.path, "output", "freecad"), license, version, stable) copyfile( os.path.join(repo.path, "backends", "licenses", li_short.strip("+")), os.path.join(repo.path, "output", "freecad", "BOLTS", "LICENSE")) for backend, backend_name in zip(["freecad", "openscad"], ["FreeCAD", "OpenSCAD"]): #construct filename from date template = "BOLTS_%s_%s_%s" % (backend_name, version, li_short) #create archives root_dir = os.path.join(repo.path, "output", backend) base_name = os.path.join(repo.path, "downloads", backend, template) make_archive(base_name, "gztar", root_dir) make_archive(base_name, "zip", root_dir)
def tasks(args): repo = Repository(args.repo) dbs = {} dbs["openscad"] = OpenSCADData(repo) dbs["freecad"] = FreeCADData(repo) dbs["drawings"] = DrawingsData(repo) # dbs["solidworks"] = SolidWorksData(repo) from backends.checker import CheckerBackend checker = CheckerBackend(repo, dbs) for task in checker.tasks.values(): print(task.print_table(),)
def check(args): repo = BOLTSRepository(args.repo) dbs = {} dbs["openscad"] = OpenSCADData(args.repo) dbs["freecad"] = FreeCADData(args.repo) dbs["drawings"] = DrawingsData(args.repo) dbs["solidworks"] = SolidWorksData(args.repo) from backends.checker import CheckerExporter checker = CheckerExporter(repo, dbs) for check in checker.checks.values(): print check.print_table()
def export(args): #load data repo = BOLTSRepository(args.repo) dbs = {} dbs["openscad"] = OpenSCADData(args.repo) dbs["freecad"] = FreeCADData(args.repo) dbs["drawings"] = DrawingsData(args.repo) dbs["solidworks"] = SolidWorksData(args.repo) license = LICENSES_SHORT[args.license] out_path = os.path.join(repo.path, "output", args.target) if args.target == "openscad": from backends.openscad import OpenSCADExporter OpenSCADExporter(repo, dbs).write_output(out_path, license, "development") copyfile( os.path.join(repo.path, "backends", "licenses", args.license.strip("+")), os.path.join(out_path, "LICENSE")) elif args.target == "freecad": from backends.freecad import FreeCADExporter FreeCADExporter(repo, dbs).write_output(out_path, license, "development") copyfile( os.path.join(repo.path, "backends", "licenses", args.license.strip("+")), os.path.join(out_path, "BOLTS", "LICENSE")) elif args.target == "html": from backends.html import HTMLExporter HTMLExporter(repo, dbs).write_output(out_path) elif args.target == "solidworks": from backends.solidworks import SolidWorksExporter SolidWorksExporter(repo, dbs).write_output(out_path, "development") elif args.target == "step": from backends.step import STEPExporter STEPExporter(repo, dbs).write_output(out_path, "development")
def release(args): # check that there are no uncommitted changes if call(["git", "diff", "--exit-code", "--quiet"]) == 1: print( "There are uncommitted changes present in the git repository. " "Please take care of them before releasing" ) exit(1) if args.kind == "stable" and args.version is None: print("Please specify a version using -v when releasing a stable version") exit(2) if args.kind == "development" and args.version is not None: print("No explicit version can be given for development releases") exit(2) repo = Repository(args.repo) version = datetime.now().strftime("%Y%m%d%H%M") stable = args.kind == "stable" if stable: version = args.version targets = [args.target] if targets[0] == "all": targets = ["freecad", "openscad", "iges"] from backends.openscad import OpenSCADBackend from backends.freecad import FreeCADBackend dbs = {} dbs["openscad"] = OpenSCADData(repo) dbs["freecad"] = FreeCADData(repo) backend_names = {"freecad": "FreeCAD", "openscad": "OpenSCAD", "iges": "IGES"} # OpenSCAD, FreeCAD export for li_short in ["lgpl2.1+", "gpl3"]: license = LICENSES_SHORT[li_short] OpenSCADBackend(repo, dbs).write_output( os.path.join(repo.path, "output", "openscad"), target_license=license, version=version, expand=not stable ) copyfile( os.path.join(repo.path, "backends", "licenses", li_short.strip("+")), os.path.join(repo.path, "output", "openscad", "LICENSE") ) FreeCADBackend(repo, dbs).write_output( os.path.join(repo.path, "output", "freecad"), target_license=license, version=version ) copyfile( os.path.join(repo.path, "backends", "licenses", li_short.strip("+")), os.path.join(repo.path, "output", "freecad", "BOLTS", "LICENSE") ) for backend in ["openscad", "freecad"]: if backend not in targets: continue backend_name = backend_names[backend] # construct filename from date template = "BOLTS_%s_%s_%s" % (backend_name, version, li_short) # create archives root_dir = os.path.join(repo.path, "output", backend) base_name = os.path.join(repo.path, "downloads", backend, template) make_archive(base_name, "gztar", root_dir) make_archive(base_name, "zip", root_dir) # iges export from backends.exchange import IGESBackend if "iges" in targets: try: import tarfile import lzma except ImportError: print("Could not find python-lzma, which is required for IGES export") return IGESBackend(repo, dbs).write_output( os.path.join(repo.path, "output", "iges"), version=version ) # write xz file, see http://stackoverflow.com/a/13131500 backend_name = backend_names["iges"] xz_name = "BOLTS_%s_%s.tar.xz" % (backend_name, version) xz_fid = lzma.LZMAFile(os.path.join(repo.path, "downloads", "iges", xz_name), mode="w") with tarfile.open(mode="w", fileobj=xz_fid) as tar_xz_fid: tar_xz_fid.add(os.path.join(repo.path, "output", "iges"), arcname="/") xz_fid.close()
from website.cache import cache from website.translation import parts_domain, gettext_parts, languages parts = Blueprint("parts",__name__,template_folder="templates",url_prefix='/<any(%s):lang_code>/parts' % ",".join(languages)) @parts.url_defaults def add_language_code(endpoint, values): values.setdefault('lang_code',g.lang_code) @parts.url_value_preprocessor def pull_language_code(endpoint, values): g.lang_code = values.pop('lang_code') repo = Repository(environ['OPENSHIFT_REPO_DIR']) dbs = { "freecad" : FreeCADData(repo), "openscad" : OpenSCADData(repo), "drawings" : DrawingsData(repo) } def get_identical_links(cl,prt): identical = [] if repo.class_standards.contains_src(cl): for s in repo.class_standards.get_dsts(cl): if s is prt: continue identical.append(html.a(s.standard.get_nice(),href=url_for('.standard',id=s.get_id()))) if repo.class_names.contains_src(cl): for n in repo.class_names.get_dsts(cl): if n is prt: continue