2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

Merge pull request #642 from codingCoffee/pip10_compat

Pip18 compatible
This commit is contained in:
Ameya Shenoy 2018-08-15 23:40:28 +05:30 committed by GitHub
commit c950b162b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 23 deletions

View File

@ -22,7 +22,7 @@ install:
script:
- cd ~
- sudo pip install --upgrade pip==9.0.3
- sudo pip install --upgrade pip
- sudo pip install -e ~/.bench
# - sudo python -m unittest bench.tests.test_setup_production.TestSetupProduction.test_setup_production_v6
- sudo python -m unittest -v bench.tests.test_setup_production

View File

@ -159,8 +159,7 @@ def migrate_env(python, no_backup = False):
), cwd = path)
pip = osp.join(pvenv, 'bin', 'pip')
# pip 10 seems to have a few problems associated with it, temporary freeze pip at 9.0.3
exec_cmd('{pip} install --upgrade pip==9.0.3'.format(pip=pip))
exec_cmd('{pip} install --upgrade pip'.format(pip=pip))
exec_cmd('{pip} install --upgrade setuptools'.format(pip=pip))
# TODO: Options

View File

@ -171,13 +171,14 @@ def which(executable, raise_err = False):
def setup_env(bench_path='.', python = 'python'):
python = which(python, raise_err = True)
pip = os.path.join(bench_path, 'env', 'bin', 'pip')
exec_cmd('virtualenv -q {} -p {}'.format('env', python), cwd=bench_path)
exec_cmd('./env/bin/pip -q install --upgrade pip==9.0.3', cwd=bench_path)
exec_cmd('./env/bin/pip -q install wheel', cwd=bench_path)
# exec_cmd('./env/bin/pip -q install https://github.com/frappe/MySQLdb1/archive/MySQLdb-1.2.5-patched.tar.gz', cwd=bench_path)
exec_cmd('./env/bin/pip -q install six', cwd=bench_path)
exec_cmd('./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit', cwd=bench_path)
exec_cmd('{} -q install --upgrade pip'.format(pip), cwd=bench_path)
exec_cmd('{} -q install wheel'.format(pip), cwd=bench_path)
# exec_cmd('{pip} -q install https://github.com/frappe/MySQLdb1/archive/MySQLdb-1.2.5-patched.tar.gz'.format(pip), cwd=bench_path)
exec_cmd('{} -q install six'.format(pip), cwd=bench_path)
exec_cmd('{} -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit'.format(pip), cwd=bench_path)
def setup_socketio(bench_path='.'):
exec_cmd("npm install socket.io redis express superagent cookie babel-core less chokidar \
@ -421,8 +422,7 @@ def update_requirements(bench_path='.'):
print('Updating Python libraries...')
pip = os.path.join(bench_path, 'env', 'bin', 'pip')
# pip 10 seems to have a few problems associated with it, temporary freeze pip at 9.0.3
exec_cmd("{pip} install --upgrade pip==9.0.3".format(pip=pip))
exec_cmd("{pip} install --upgrade pip".format(pip=pip))
apps_dir = os.path.join(bench_path, 'apps')

View File

@ -36,7 +36,7 @@ def install_bench(args):
# secure pip installation
if find_executable('pip'):
run_os_command({
'pip': 'sudo pip install --upgrade setuptools urllib3 requests cryptography pip==9.0.3'
'pip': 'sudo pip install --upgrade setuptools urllib3 requests cryptography pip'
})
else:
@ -51,7 +51,7 @@ def install_bench(args):
if success:
run_os_command({
'pip': 'sudo pip install --upgrade setuptools urllib3 requests cryptography pip==9.0.3'
'pip': 'sudo pip install --upgrade setuptools urllib3 requests cryptography pip'
})
success = run_os_command({
@ -374,7 +374,7 @@ def parse_commandline_args():
parser.add_argument('--frappe-branch', dest='frappe_branch', action='store',
help='Clone a particular branch of frappe')
parser.add_argument('--erpnext-repo-url', dest='erpnext_repo_url', action='store', default='https://github.com/frappe/erpnext',
parser.add_argument('--erpnext-repo-url', dest='erpnext_repo_url', action='store', default='https://github.com/frappe/erpnext',
help='Clone erpnext from the given url')
parser.add_argument('--erpnext-branch', dest='erpnext_branch', action='store',

View File

@ -1,18 +1,15 @@
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
# get version from __version__ variable in bench/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('bench/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
requirements = parse_requirements("requirements.txt", session="")
with open('bench/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='bench',
@ -23,8 +20,7 @@ setup(
packages=find_packages(),
zip_safe=False,
include_package_data=True,
install_requires=[str(ir.req) for ir in requirements],
dependency_links=[str(ir._link) for ir in requirements if ir._link],
install_requires=install_requires,
entry_points='''
[console_scripts]
bench=bench.cli:cli