Browse Source

Enforce static media compilation as part of sdist

David Cramer 10 years ago
parent
commit
b87001f106
2 changed files with 20 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 19 0
      setup.py

+ 1 - 0
.gitignore

@@ -7,6 +7,7 @@
 *.egg
 *.db
 *.pid
+MANIFEST
 test.conf
 pip-log.txt
 /htmlcov

+ 19 - 0
setup.py

@@ -22,7 +22,10 @@ any application.
 :license: BSD, see LICENSE for more details.
 """
 
+from distutils import log
+from distutils.command.sdist import sdist
 from setuptools import setup, find_packages
+from subprocess import check_output
 
 
 # Hack to prevent stupid "TypeError: 'NoneType' object is not callable" error
@@ -109,6 +112,19 @@ mysql_requires = [
 ]
 
 
+class CustomSdist(sdist):
+    """
+    Identical to the built-in sdist command except that we need to generate
+    static media before building the tarball.
+    """
+    def make_distribution(self):
+        log.info("running npm install")
+        check_output(['npm', 'install', '--quiet'])
+        log.info("running sentry compilestatic")
+        check_output(['sentry', 'compilestatic'])
+        return sdist.make_distribution(self)
+
+
 setup(
     name='sentry',
     version='7.0.0-DEV',
@@ -128,6 +144,9 @@ setup(
         'postgres_pypy': install_requires + postgres_pypy_requires,
         'mysql': install_requires + mysql_requires,
     },
+    cmdclass={
+        'sdist': CustomSdist,
+    },
     license='BSD',
     include_package_data=True,
     entry_points={