mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +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():
|
||||
shutil.rmtree(str(env_path))
|
||||
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_vars = ' '.join(env_vars)
|
||||
if cmd.split()[0] == 'python':
|
||||
cmd = cmd.replace('python', str(env_py))
|
||||
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:
|
||||
return local('{env_vars} {env_py} -m {cmd}'.format(
|
||||
env_py=env_py, cmd=cmd, env_vars=env_vars),
|
||||
|
@ -58,6 +64,7 @@ def make():
|
|||
with virtualenv(VENV_DIR) as venv_local:
|
||||
with lcd(path.dirname(__file__)):
|
||||
venv_local('pip install -r requirements.txt')
|
||||
venv_local('pip install pex')
|
||||
venv_local('python setup.py build_ext --inplace', env_vars=['PYTHONPATH=`pwd`'])
|
||||
|
||||
def sdist():
|
||||
|
@ -70,6 +77,11 @@ def wheel():
|
|||
with lcd(path.dirname(__file__)):
|
||||
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():
|
||||
with lcd(path.dirname(__file__)):
|
||||
|
|
Loading…
Reference in New Issue
Block a user