2020-07-06 14:04:28 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import subprocess
|
2020-08-04 00:29:29 +00:00
|
|
|
import os
|
2020-07-06 14:04:28 +00:00
|
|
|
from pathlib import Path
|
|
|
|
|
2020-08-04 00:29:29 +00:00
|
|
|
|
2020-07-06 14:04:28 +00:00
|
|
|
def runcmd(cmd):
|
2020-08-04 00:29:29 +00:00
|
|
|
if os.name == "nt":
|
|
|
|
return subprocess.check_output(cmd, shell=True)
|
2020-07-06 14:04:28 +00:00
|
|
|
proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
|
|
|
|
return proc.communicate()
|
|
|
|
|
2020-08-04 00:29:29 +00:00
|
|
|
|
2020-07-06 14:04:28 +00:00
|
|
|
print('Installing npm packages')
|
|
|
|
|
|
|
|
root_path = Path(__file__).parents[1]
|
2020-08-04 17:12:18 +00:00
|
|
|
if os.name == 'nt':
|
|
|
|
root_path /= 'node_modules'
|
|
|
|
runcmd(f'npm install')
|
2020-07-06 14:04:28 +00:00
|
|
|
|
|
|
|
if (root_path / 'node_modules' / 'cleancss').exists():
|
|
|
|
print(f'Installed successfully in {str((root_path / "node_modules").resolve())}.')
|
|
|
|
|
2020-08-04 17:12:18 +00:00
|
|
|
|