def __init__(self, project_root, output_dir, java_version, include_modules=None, exclude_modules=None, include_patterns=None, exclude_patterns=None, cache_dir=None, extra_deps=None, maven_flags=None, maven_repo=None, maven_settings_file=None, verbose=False): logger.info("Using output directory " + output_dir) self.output_dir = output_dir logger.info("Selecting Java version %s", java_version) self.java_version = java_version self.maven_project = mavenproject.MavenProject( project_root, include_modules=include_modules, exclude_modules=exclude_modules, include_patterns=include_patterns, exclude_patterns=exclude_patterns) self.packager = packager.Packager( self.maven_project, self.output_dir, cache_dir=cache_dir, extra_deps=extra_deps, maven_flags=maven_flags, maven_repo=maven_repo, maven_settings_file=maven_settings_file, verbose=verbose) self.isolated_files = [] self._maven_flags = maven_flags
def do_packaging(path, deps_filename='', output_filename='lambda_package.zip'): '''runner function''' pkgr = packager.Packager(path, deps_filename, output_filename) pkgr.package() output = pkgr.output() zipped_filename = zipfile.ZipFile(output['output_filename'], 'r') zip_contents = {} for name in zipped_filename.namelist(): zip_contents[name] = zipped_filename.read(name) zipped_filename.close() return {'output': output, 'zip_contents': zip_contents}
def do(input_values): p = packager.Packager(input_values) p.package() output = p.output() zf = zipfile.ZipFile(output["output_filename"], 'r') zip_contents = {} for name in zf.namelist(): zip_contents[name] = zf.read(name) zf.close() return { "output": output, "zip_contents": zip_contents }
def do(input_values): if not input_values.has_key("output_filename"): input_values["output_filename"] = "" if not input_values.has_key("extra_files"): input_values["extra_files"] = '' p = packager.Packager(input_values) p.package() output = p.output() zf = zipfile.ZipFile(output["output_filename"], 'r') zip_contents = {} for name in zf.namelist(): zip_contents[name] = zf.read(name) zf.close() return {"output": output, "zip_contents": zip_contents}
# Dependencies are automatically detected, but it might need fine tuning. build_exe_options = { "packages": ["os"], "excludes": ["tkinter"], "include_files": includefiles, # "path": sys.path + [PROJECTPATH], # "build_exe": PROJECTPATH, } # GUI applications require a different base on Windows (the default is for a # console application). base = None if sys.platform == "win32": base = "Win32GUI" setup( name=name, version=version, # path = sys.path + [PROJECTPATH], description="The Unique File Analyzer", options={"build_exe": build_exe_options}, executables=[Executable("Uniquity.py", base=base)]) #Package the application curpath = os.path.abspath(".") buildpath = os.path.abspath("build") os.chdir(PACKAGEPATH) pkg = packager.Packager("-".join((name, version)), buildpath, version) os.chdir(curpath)