def _python_get_deps(package_name): """ Function that is run in a subprocess to return active dependencies of a given package. """ from pkglib.setuptools.dependency import get_all_requirements, get_dist pkg = get_dist(package_name).project_name if pkg: try: print('\n'.join(d.project_name for d in get_all_requirements([pkg], True))) except: print('\n'.join(d.project_name for d in get_all_requirements([pkg])))
def _python_get_deps(package_name): """ Function that is run in a subprocess to return active dependencies of a given package. """ from pkglib.setuptools.dependency import get_all_requirements, get_dist pkg = get_dist(package_name).project_name if pkg: try: print('\n'.join(d.project_name for d in get_all_requirements([pkg], True))) except: print('\n'.join(d.project_name for d in get_all_requirements([pkg])))
def post_setup(self): """ Upload the dependencies for pkglib so tagup can bootstrap itself as well as run tests on generated packages """ # Lazy import here to get around pkg build circle from pkglib.setuptools.dependency import get_all_requirements work_dir = os.path.join(self.workspace, 'pkglib-deps') if not os.path.exists(work_dir): os.makedirs(work_dir) with open(os.path.join(work_dir, '.pypirc'), 'wb') as rc_file: self.get_rc().write(rc_file) # XXX find a better way to pass in credentials new_env = copy.copy(dict(os.environ)) new_env['HOME'] = work_dir for dist in get_all_requirements(['pkglib', 'pytest-cov']): # Quick hack to get the built eggs into the test PyPi instance. # We register with an empty package file then copy the files in manually name = dist.project_name # We may need pip and distribute if virtualenv installed old versions. # (should only occur when upgrading to new virtualenv). if name in ['pkglib', 'virtualenv', 'setuptools']: continue version = dist.version with open(os.path.join(work_dir, 'setup.py'), 'wb') as fp: fp.write(SETUP_TMPL % {'name': name, 'version': version}) out = self.run('cd %s; %s setup.py register' % (work_dir, self.python), capture=True, env=new_env) logger.debug(out) assert '200' in out self.upload_requirement(work_dir, dist.as_requirement())
def get_pkglib_reqs(): from pkglib.setuptools.dependency import get_all_requirements return [(dist.project_name, dist.version) for dist in get_all_requirements(['pkglib', 'pytest', 'pytest-cov'], ignore_explicit_builtins=True) if dist.project_name not in ['virtualenv', 'setuptools']]