def bundle_func(args): def get_reqs(path): path = os.path.abspath(path) reqs = set() with open(path) as f: for line in f: line = line.strip() if not line or line.startswith('#'): continue reqs.add(line) return reqs if not args.packages: logger.fatal('Error: You must specify at least one package', exc=PygError) reqs = [] if args.req_file: reqs = [Requirement(r) for f in args.req_file for r in get_reqs(f)] b = Bundler(map(Requirement, args.packages) + reqs, args.bundlename) b.bundle()
def bundle_func(packages, bundlename, exclude, req_file, develop): def get_reqs(path): path = os.path.abspath(path) reqs = set() with open(path) as f: for line in f: line = line.strip() if not line or line.startswith('#'): continue reqs.add(line) return reqs if not packages and not req_file: logger.fatal('Error: You must specify at least one package', exc=PygError) reqs = [] if req_file: reqs = [Requirement(r) for f in req_file for r in get_reqs(f)] exclude = [Requirement(r) for r in (exclude or [])] bundlename = os.path.abspath(bundlename) dest, bundlename = os.path.dirname(bundlename), os.path.basename(bundlename) b = Bundler(map(Requirement, packages) + reqs, bundlename, exclude, use_develop=develop) b.bundle(dest=dest)