def parse_reqs(reqs_file): ''' parse the requirements ''' options = Option("--workaround") options.skip_requirements_regex = None # Hack for old pip versions if pip.__version__.startswith('10.'): # Versions greater or equal to 10.x don't rely on pip.req.parse_requirements install_reqs = list(val.strip() for val in open(reqs_file)) reqs = install_reqs elif pip.__version__.startswith('1.'): # Versions 1.x rely on pip.req.parse_requirements # but don't require a "session" parameter from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error install_reqs = parse_requirements(reqs_file, options=options) reqs = [str(ir.req) for ir in install_reqs] else: # Versions greater than 1.x but smaller than 10.x rely on pip.req.parse_requirements # and requires a "session" parameter from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error from pip.download import PipSession # pylint:disable=no-name-in-module, import-error options.isolated_mode = False install_reqs = parse_requirements( # pylint:disable=unexpected-keyword-arg reqs_file, session=PipSession, options=options ) reqs = [str(ir.req) for ir in install_reqs] return reqs
def parse_reqs(reqs_file): ''' parse the requirements ''' options = Option("--workaround") options.skip_requirements_regex = None options.isolated_mode = True install_reqs = parse_requirements(reqs_file, options=options, session=PipSession()) return [str(ir.req) for ir in install_reqs]
def parse_reqs(reqs_file): """ parse the requirements """ options = Option("--workaround") options.skip_requirements_regex = None # Hack for old pip versions: Versions greater than 1.x # have a required parameter "sessions" in parse_requierements if pip.__version__.startswith("1."): install_reqs = parse_requirements(reqs_file, options=options) else: from pip.download import PipSession # pylint:disable=E0611 options.isolated_mode = False install_reqs = parse_requirements(reqs_file, options=options, session=PipSession) # pylint:disable=E1123 return [str(ir.req) for ir in install_reqs]
def parse_reqs(reqs_file): ''' parse the requirements ''' options = Option('--workaround') options.skip_requirements_regex = None # Hack for old pip versions: Versions greater than 1.x # have a required parameter "sessions" in parse_requierements if pip.__version__.startswith('1.'): install_reqs = parse_requirements(reqs_file, options=options) else: from pip.download import PipSession # pylint:disable=E0611 options.isolated_mode = False install_reqs = parse_requirements( reqs_file, # pylint:disable=E1123 options=options, session=PipSession) return [str(ir.req) for ir in install_reqs]
def parse_reqs(reqs_file): ''' parse the requirements ''' options = Option('--workaround') options.skip_requirements_regex = None # Hack for old pip versions # Versions greater than 1.x have a required parameter "session" in # parse_requirements if pip.__version__.startswith('1.'): install_reqs = parse_requirements(reqs_file, options=options) else: from pip.download import PipSession # pylint:disable=no-name-in-module options.isolated_mode = False install_reqs = parse_requirements( # pylint:disable=unexpected-keyword-arg reqs_file, session=PipSession, options=options) return [str(ir.req) for ir in install_reqs]
if pip.__version__.startswith('10.'): # Versions greater or equal to 10.x don't rely on pip.req.parse_requirements install_reqs = list(val.strip() for val in open(reqs_file)) reqs = install_reqs elif pip.__version__.startswith('1.'): # Versions 1.x rely on pip.req.parse_requirements # but don't require a "session" parameter from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error install_reqs = parse_requirements(reqs_file, options=options) reqs = [str(ir.req) for ir in install_reqs] else: # Versions greater than 1.x but smaller than 10.x rely on pip.req.parse_requirements # and require a "session" parameter from pip.req import parse_requirements # pylint:disable=no-name-in-module, import-error from pip.download import PipSession # pylint:disable=no-name-in-module, import-error options.isolated_mode = False install_reqs = parse_requirements( # pylint:disable=unexpected-keyword-arg reqs_file, session=PipSession, options=options) reqs = [str(ir.req) for ir in install_reqs] # ensure we install numpy before the main list of requirements, ignore # failures if numpy/cython are not requirements and just proceed (future proof) try: cython_req = next(r for r in reqs if r.startswith('cython')) numpy_req = next(r for r in reqs if r.startswith('numpy')) if pip.__version__.startswith('10.'): import subprocess subprocess.check_call([ "python", '-m', 'pip', 'install', "--no-clean", "--user",
import pip import src from pip.req import parse_requirements options = Option("--workaround") options.skip_requirements_regex = None reqs_file = './requirements.txt' # Hack for old pip versions # Versions greater than 1.x have a required parameter "session" in parse_requirements if pip.__version__.startswith('1.'): requirements = parse_requirements(reqs_file, options=options) else: from pip.download import PipSession options.isolated_mode = False requirements = parse_requirements( reqs_file, session=PipSession, options=options ) reqs = [str(ir.req) for ir in requirements] config = { 'description': 'Mouse Locomotion Simulation', 'author': 'HBP Neurorobotics', 'url': 'http://neurorobotics.net', 'author_email': '*****@*****.**', 'version': src.__version__, 'install_requires': reqs, 'packages': ['src',
import pip from setuptools import setup from pip.req import parse_requirements try: import pypandoc long_description = pypandoc.convert('../README.md', 'rst') except (IOError, ImportError): long_description = open('../README.md').read() # This is a hack to work with newer versions of pip if (pip.__version__.startswith('1.5') or int(pip.__version__[:1]) > 5): from pip.download import PipSession # pylint:disable=E0611 OPTIONS = Option("--workaround") OPTIONS.skip_requirements_regex = None OPTIONS.isolated_mode = False # pylint:disable=E1123 INSTALL_REQS = parse_requirements(os.path.join(os.path.dirname(__file__), "requirements.txt"), options=OPTIONS, session=PipSession) else: # this is the production path, running on RHEL OPTIONS = Option("--workaround") OPTIONS.skip_requirements_regex = None INSTALL_REQS = parse_requirements(os.path.join(os.path.dirname(__file__), "requirements.txt"), options=OPTIONS) reqs = [str(ir.req) for ir in INSTALL_REQS] setup(name='pyxus',
#!/usr/bin/env python """ HBP Collaboratory python oauth2 module """ from setuptools import setup from hbp_app_python_auth.version import VERSION from pip.req import parse_requirements from optparse import Option import pip #This is a hack to work with newer versions of pip if pip.__version__.startswith('1.5') or pip.__version__.startswith('6') or pip.__version__.startswith('7') : from pip.download import PipSession # pylint:disable=E0611 OPTIONS = Option("--workaround") OPTIONS.skip_requirements_regex = None OPTIONS.isolated_mode = False INSTALL_REQS = parse_requirements("./requirements.txt", # pylint:disable=E1123 options=OPTIONS, session=PipSession) else: # this is the production path, running on RHEL OPTIONS = Option("--workaround") OPTIONS.skip_requirements_regex = None INSTALL_REQS = parse_requirements("./requirements.txt", options=OPTIONS) REQS = [str(ir.req) for ir in INSTALL_REQS] setup(name='hbp-app-python-auth', version=VERSION, description='hbp collaboratory python oauth2 module', packages=['hbp_app_python_auth'], author='bbp platform team',