Skip to content

Commit

Permalink
Merge pull request #918 from timkpaine/sdist_check
Browse files Browse the repository at this point in the history
adding sdist check so we don't deploy broken sdists accidentally
  • Loading branch information
texodus authored Feb 12, 2020
2 parents de37d85 + fec60e8 commit 5d29483
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion python/perspective/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
)

0 comments on commit 5d29483

Please sign in to comment.