mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-11 00:32:40 +03:00
Add fab pex command
This commit is contained in:
parent
dbbfc02bda
commit
6044d55f0f
14
fabfile.py
vendored
14
fabfile.py
vendored
|
@ -21,12 +21,18 @@ def virtualenv(name, create=False, python='/usr/bin/python3.6'):
|
||||||
if env_path.exists():
|
if env_path.exists():
|
||||||
shutil.rmtree(str(env_path))
|
shutil.rmtree(str(env_path))
|
||||||
local('{python} -m venv {env_path}'.format(python=python, env_path=VENV_DIR))
|
local('{python} -m venv {env_path}'.format(python=python, env_path=VENV_DIR))
|
||||||
def wrapped_local(cmd, env_vars=[], capture=False):
|
def wrapped_local(cmd, env_vars=[], capture=False, direct=False):
|
||||||
env_py = env_path / 'bin' / 'python'
|
env_py = env_path / 'bin' / 'python'
|
||||||
env_vars = ' '.join(env_vars)
|
env_vars = ' '.join(env_vars)
|
||||||
if cmd.split()[0] == 'python':
|
if cmd.split()[0] == 'python':
|
||||||
cmd = cmd.replace('python', str(env_py))
|
cmd = cmd.replace('python', str(env_py))
|
||||||
return local(env_vars + ' ' + cmd, capture=capture)
|
return local(env_vars + ' ' + cmd, capture=capture)
|
||||||
|
elif direct:
|
||||||
|
cmd, args = cmd.split(' ', 1)
|
||||||
|
env_cmd = str(env_py).replace('python', cmd)
|
||||||
|
return local('{env_vars} {env_cmd} {args}'.format(
|
||||||
|
env_cmd=env_cmd, args=args, env_vars=env_vars),
|
||||||
|
capture=capture)
|
||||||
else:
|
else:
|
||||||
return local('{env_vars} {env_py} -m {cmd}'.format(
|
return local('{env_vars} {env_py} -m {cmd}'.format(
|
||||||
env_py=env_py, cmd=cmd, env_vars=env_vars),
|
env_py=env_py, cmd=cmd, env_vars=env_vars),
|
||||||
|
@ -58,6 +64,7 @@ def make():
|
||||||
with virtualenv(VENV_DIR) as venv_local:
|
with virtualenv(VENV_DIR) as venv_local:
|
||||||
with lcd(path.dirname(__file__)):
|
with lcd(path.dirname(__file__)):
|
||||||
venv_local('pip install -r requirements.txt')
|
venv_local('pip install -r requirements.txt')
|
||||||
|
venv_local('pip install pex')
|
||||||
venv_local('python setup.py build_ext --inplace', env_vars=['PYTHONPATH=`pwd`'])
|
venv_local('python setup.py build_ext --inplace', env_vars=['PYTHONPATH=`pwd`'])
|
||||||
|
|
||||||
def sdist():
|
def sdist():
|
||||||
|
@ -70,6 +77,11 @@ def wheel():
|
||||||
with lcd(path.dirname(__file__)):
|
with lcd(path.dirname(__file__)):
|
||||||
venv_local('python setup.py bdist_wheel')
|
venv_local('python setup.py bdist_wheel')
|
||||||
|
|
||||||
|
def pex():
|
||||||
|
with virtualenv(VENV_DIR) as venv_local:
|
||||||
|
with lcd(path.dirname(__file__)):
|
||||||
|
venv_local('pex . -e spacy -o dist/spacy', direct=True)
|
||||||
|
|
||||||
|
|
||||||
def clean():
|
def clean():
|
||||||
with lcd(path.dirname(__file__)):
|
with lcd(path.dirname(__file__)):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user