From c7e5d67438623601b7fb962af32974e2e1cf16ea Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Sun, 25 Feb 2018 16:53:27 +0100 Subject: [PATCH] correctly add static data to source distribution --- MANIFEST.in | 1 + setup.py | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) create mode 100644 MANIFEST.in mode change 100644 => 100755 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..1824c6a09 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +include-recursive zesje/static/* diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index defffb0b3..a88274485 --- a/setup.py +++ b/setup.py @@ -1,23 +1,20 @@ -from setuptools import setup, find_packages -from distutils.command.build import build -from setuptools.command.sdist import sdist - - -def webpack(): - import subprocess - subprocess.check_call(['yarn', 'install']) - subprocess.check_call(['yarn', 'build']) +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import sys +from setuptools import setup, find_packages +from setuptools.command.sdist import sdist as sdist_orig -class Build(build): - def run(self): - webpack() - super().run() +if sys.version_info < (3, 6): + print('zesje requires Python 3.6 or higher') + sys.exit(1) -class Sdist(sdist): +class sdist(sdist_orig): def run(self): - webpack() + import subprocess + subprocess.check_call(['yarn', 'install']) + subprocess.check_call(['yarn', 'build']) super().run() @@ -29,9 +26,7 @@ setup( author="Zesje authors", author_email="anton.akhmerov@tudelft.nl", packages=find_packages('.'), - cmdclass={'build': Build, - 'sdist': Sdist, - }, + cmdclass=dict(sdist=sdist), package_data={'zesje': ['static/*']}, include_package_data=True, ) -- GitLab