Minor fixes to get setup.py to work on Windows

This commit is contained in:
Hirschfeld
2017-07-13 16:41:14 +10:00
parent 8373c4619e
commit f25ec3c3f0

View File

@@ -119,7 +119,8 @@ from distutils.command.build_py import build_py
from distutils.command.sdist import sdist
npm_path = ':'.join([
sep = ';' if os.name == 'nt' else ':'
npm_path = sep.join([
pjoin(here, 'node_modules', '.bin'),
os.environ.get("PATH", os.defpath),
])
@@ -179,13 +180,11 @@ class Bower(BaseCommand):
env = os.environ.copy()
env['PATH'] = npm_path
args = ['bower', 'install', '--allow-root', '--config.interactive=false']
if os.name == 'nt':
args = ['cmd', '/C'] + args
try:
check_call(
['bower', 'install', '--allow-root', '--config.interactive=false'],
cwd=here,
env=env,
)
check_call(args, cwd=here, env=env)
except OSError as e:
print("Failed to run bower: %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr)
@@ -234,14 +233,17 @@ class CSS(BaseCommand):
env = os.environ.copy()
env['PATH'] = npm_path
args = [
'lessc', '--clean-css',
'--source-map-basepath={}'.format(static),
'--source-map={}'.format(sourcemap),
'--source-map-rootpath=../',
style_less, style_css,
]
if os.name == 'nt':
args = ['cmd', '/C'] + args
try:
check_call([
'lessc', '--clean-css',
'--source-map-basepath={}'.format(static),
'--source-map={}'.format(sourcemap),
'--source-map-rootpath=../',
style_less, style_css,
], cwd=here, env=env)
check_call(args, cwd=here, env=env)
except OSError as e:
print("Failed to run lessc: %s" % e, file=sys.stderr)
print("You can install js dependencies with `npm install`", file=sys.stderr)