Revert "removed bad code and made compatible with pip 10 (#13685)" (#13713)

This reverts commit 91b0dce4d8.
This commit is contained in:
Rushabh Mehta 2018-04-18 02:57:44 -08:00 committed by GitHub
parent 91b0dce4d8
commit ff8f1bc88e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuptools import setup, find_packages from setuptools import setup, find_packages
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
import re, ast import re, ast
# get version from __version__ variable in erpnext/__init__.py # get version from __version__ variable in erpnext/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)') _version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
with open('erpnext/__init__.py', 'rb') as f: with open('erpnext/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search( version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1))) f.read().decode('utf-8')).group(1)))
@ -23,5 +24,6 @@ setup(
packages=find_packages(), packages=find_packages(),
zip_safe=False, zip_safe=False,
include_package_data=True, include_package_data=True,
install_requires=install_requires install_requires=[str(ir.req) for ir in requirements],
dependency_links=[str(ir._link) for ir in requirements if ir._link]
) )