From fec60e8c159ef0c5478893eebd635ff8e430fc3d Mon Sep 17 00:00:00 2001 From: Tim Paine Date: Tue, 11 Feb 2020 21:38:41 -0500 Subject: [PATCH] adding sdist check so we don't deploy broken sdists accidentally --- python/perspective/setup.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/perspective/setup.py b/python/perspective/setup.py index 45d5bba1b0..8e42b56a87 100644 --- a/python/perspective/setup.py +++ b/python/perspective/setup.py @@ -8,6 +8,7 @@ from __future__ import print_function from setuptools import setup, find_packages, Extension from setuptools.command.build_ext import build_ext +from setuptools.command.sdist import sdist from distutils.version import LooseVersion from distutils import sysconfig from codecs import open @@ -205,6 +206,18 @@ def build_extension_cmake(self, ext): print() # Add an empty line for cleaner output +class PSPCheckSDist(sdist): + def run(self): + self.run_check() + super(PSPCheckSDist, self).run() + + def run_check(self): + for file in ('CMakeLists.txt', 'cmake', 'src', 'test'): + path = os.path.abspath(os.path.join(here, 'dist', file)) + if not os.path.exists(path): + raise Exception("Path is missing! {}\nMust run `yarn build_python` before building sdist so cmake files are installed".format(path)) + + setup( name='perspective-python', version=version, @@ -234,5 +247,5 @@ def build_extension_cmake(self, ext): 'dev': requires_dev, }, ext_modules=[PSPExtension('perspective')], - cmdclass=dict(build_ext=PSPBuild), + cmdclass=dict(build_ext=PSPBuild, sdist=PSPCheckSDist), )