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