def build_external_deps_rpms(channel, options): # let's build the external reqs RPMS req_file = os.path.join(os.getcwd(), '%s-reqs.txt' % channel) if not os.path.exists(req_file): print("Can't find the req file for the %s channel." % channel) sys.exit(0) # if not dev, check for pinned versions. if channel != 'dev': non_pinned = get_non_pinned(req_file) if len(non_pinned) > 0: deps = ', '.join(non_pinned) raise DependencyError('Unpinned dependencies: %s' % deps) # we have a requirement file, we can go ahead and feed pypi2rpm with it with open(req_file) as f: for line in f.readlines(): line = line.strip() if not line or line.startswith('#'): continue project, version = split_version(line) build_rpm(project=project, dist_dir=options.dist_dir, version=version, index=options.index, download_cache=options.download_cache)
def build_external_deps(channel, index, extras, timeout=300, verbose=False, cache=None): # looking for a req file reqname = '%s-reqs.txt' % channel if not os.path.exists(reqname): return # if not dev, check for pinned versions. if channel != 'dev': non_pinned = get_non_pinned(reqname) if len(non_pinned) > 0: deps = ', '.join(non_pinned) raise DependencyError('Unpinned dependencies: %s' % deps) if os.path.exists('build'): root = 'build' inc = 1 while os.path.exists(root + str(inc)): inc += 1 os.rename('build', root + str(inc)) pip = '%s install -i %s -U -r %s' args = (PIP, index, reqname) if cache is not None: pip += ' --download-cache %s' args += (cache, ) if extras is not None: pip += ' --extra-index-url %s' args += (extras, ) run(pip % args, timeout, verbose)
def build_external_deps(channel, index, extras, timeout=300, verbose=False, cache=None): # looking for a req file reqname = '%s-reqs.txt' % channel if not os.path.exists(reqname): return # if not dev, check for pinned versions. if channel != 'dev': non_pinned = get_non_pinned(reqname) if len(non_pinned) > 0: deps = ', '.join(non_pinned) raise DependencyError('Unpinned dependencies: %s' % deps) if os.path.exists('build'): root = 'build' inc = 1 while os.path.exists(root + str(inc)): inc += 1 os.rename('build', root + str(inc)) pip = '%s install -i %s -U -r %s' args = (PIP, index, reqname) if cache is not None: pip += ' --download-cache %s' args += (cache,) if extras is not None: pip += ' --extra-index-url %s' args += (extras,) run(pip % args, timeout, verbose)
def test_pinning(self): reqs = os.path.join(os.path.dirname(__file__), 'dev-reqs.txt') unpinned = util.get_non_pinned(reqs) unpinned.sort() self.assertEqual(unpinned, ['Paste', 'translationstring', 'wsgi-intercept'])