Add asset building to setup

pull/15/head
JamesRamm 2017-02-10 09:18:37 +00:00
rodzic 5d432b31d3
commit 857c47cc9f
1 zmienionych plików z 22 dodań i 4 usunięć

Wyświetl plik

@ -3,11 +3,26 @@
import os
import re
import sys
import subprocess
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import setup
from setuptools.command.sdist import sdist as base_sdist
class sdist(base_sdist):
def compile_assets(self):
'''
Compile the front end assets
'''
try:
subprocess.check_call(['npm', '--prefix', 'longclaw/client/', 'run', 'build'])
except (OSError, subprocess.CalledProcessError) as err:
print('Error compiling assets: {}'.format(err))
raise SystemExit(1)
def run(self):
self.compile_assets()
base_sdist.run(self)
def get_version(*file_paths):
@ -83,4 +98,7 @@ setup(
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
cmdclass={
'sdist': sdist
}
)