Skip to content

Commit

Permalink
Raise an error if node or npm are not installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
bazzisoft committed Mar 3, 2017
1 parent 1fe3a8d commit 6ed5ebf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

1.0.14
------
- Raise an error if `node` or `npm` are not installed.


1.0.13
------
- Bugfix: Resolved errors with `npm install` on linux with bdist_wheel (https://github.com/bazzisoft/webmake/issues/2).
Expand Down
Binary file added dist/webmake-1.0.14.zip
Binary file not shown.
23 changes: 21 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from setuptools.command.install import install as setuptools_install
Expand All @@ -13,6 +12,8 @@
from codecs import open
from os import path
import os
import sys
import subprocess


here = path.abspath(path.dirname(__file__))
Expand All @@ -24,6 +25,24 @@
short_description = contents.splitlines()[2]
long_description = '\n'.join(contents.splitlines()[2:]).split('----------')[0]


# Ensure required packages are installed
def program_is_installed(msg, prog):
try:
sys.stdout.write(msg)
sys.stdout.flush()
subprocess.check_call(prog, shell=True)
except:
return False
return True


if not program_is_installed('Detecting nodejs...', 'node -v') or not program_is_installed('Detecting npm...', 'npm -v'):
sys.stderr.write('\n' + '-' * 79)
sys.stderr.write('\nERROR: webmake requires `node` and `npm` to be available prior to installation.')
sys.stderr.write('\n' + '-' * 79 + '\n\n')
raise Exception('webmake requires `node` and `npm` to be available prior to installation.')


# Setup post install script
def _post_install(dir):
Expand Down Expand Up @@ -61,7 +80,7 @@ def run(self):
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='1.0.13',
version='1.0.14',

description=short_description,
long_description=long_description,
Expand Down

0 comments on commit 6ed5ebf

Please sign in to comment.