1
0
mirror of https://github.com/gsi-upm/soil synced 2024-12-22 08:18:13 +00:00

Fix pip installation

This commit is contained in:
J. Fernando Sánchez 2018-05-04 09:59:31 +02:00
parent 497c8a55db
commit 73c90887e8
4 changed files with 37 additions and 15 deletions

View File

@ -1,20 +1,21 @@
import pip
import os
from setuptools import setup
# parse_requirements() returns generator of pip.req.InstallRequirement objects
from pip.req import parse_requirements
from soil import __version__
try:
install_reqs = parse_requirements(
"requirements.txt", session=pip.download.PipSession())
test_reqs = parse_requirements(
"test-requirements.txt", session=pip.download.PipSession())
except AttributeError:
install_reqs = parse_requirements("requirements.txt")
test_reqs = parse_requirements("test-requirements.txt")
install_reqs = [str(ir.req) for ir in install_reqs]
test_reqs = [str(ir.req) for ir in test_reqs]
with open(os.path.join('soil', 'VERSION')) as f:
__version__ = f.read().strip()
assert __version__
def parse_requirements(filename):
""" load requirements from a pip requirements file """
with open(filename, 'r') as f:
lineiter = list(line.strip() for line in f)
return [line for line in lineiter if line and not line.startswith("#")]
install_reqs = parse_requirements("requirements.txt")
test_reqs = parse_requirements("test-requirements.txt")
setup(

1
soil/VERSION Normal file
View File

@ -0,0 +1 @@
0.10.2

View File

@ -4,7 +4,7 @@ import os
import pdb
import logging
__version__ = "0.10.1"
from .version import __version__
try:
basestring

20
soil/version.py Normal file
View File

@ -0,0 +1,20 @@
import os
import logging
logger = logging.getLogger(__name__)
ROOT = os.path.dirname(__file__)
DEFAULT_FILE = os.path.join(ROOT, 'VERSION')
def read_version(versionfile=DEFAULT_FILE):
try:
with open(versionfile) as f:
return f.read().strip()
except IOError: # pragma: no cover
logger.error(('Running an unknown version of {}.'
'Be careful!.').format(__name__))
return '0.0'
__version__ = read_version()