mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-24 01:57:32 +01:00
Check for and warn about missing assets in setup.py install
This commit is contained in:
parent
136d97dca2
commit
0be22dc3f0
5
setup.py
5
setup.py
@ -1,13 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
from setuptools.command.sdist import sdist
|
||||
|
||||
from wagtail.wagtailcore import __version__
|
||||
from wagtail.utils.setup import assets, add_subcommand
|
||||
|
||||
from wagtail.utils.setup import assets, add_subcommand, check_bdist_egg
|
||||
|
||||
try:
|
||||
from setuptools import setup, find_packages
|
||||
@ -83,6 +81,7 @@ setup(
|
||||
zip_safe=False,
|
||||
cmdclass={
|
||||
'sdist': add_subcommand(sdist, [('assets', None)]),
|
||||
'bdist_egg': check_bdist_egg,
|
||||
'assets': assets,
|
||||
},
|
||||
)
|
||||
|
@ -1,8 +1,12 @@
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from distutils.core import Command
|
||||
|
||||
from setuptools.command.bdist_egg import bdist_egg
|
||||
|
||||
|
||||
class assets(Command):
|
||||
|
||||
@ -22,10 +26,26 @@ class assets(Command):
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
class check_bdist_egg(bdist_egg):
|
||||
|
||||
# If this file does not exist, warn the user to compile the assets
|
||||
sentinel_file = 'wagtail/wagtailadmin/static/wagtailadmin/css/core.css'
|
||||
|
||||
def run(self):
|
||||
bdist_egg.run(self)
|
||||
if not os.path.isfile(self.sentinel_file):
|
||||
print("\n".join([
|
||||
"************************************************************",
|
||||
"The front end assets for Wagtail are missing.",
|
||||
"To generate the assets, please refer to the documentation in",
|
||||
"docs/contributing/css_guidelines.rst",
|
||||
"************************************************************",
|
||||
]))
|
||||
|
||||
|
||||
def add_subcommand(command, extra_sub_commands):
|
||||
# Sadly, as commands are old-style classes, `type()` can not be used to
|
||||
# construct these. Additionally, old-style classes do not have a `name`
|
||||
# attribute, so naming them nicely is also impossible.
|
||||
# construct these.
|
||||
class CompileAnd(command):
|
||||
sub_commands = command.sub_commands + extra_sub_commands
|
||||
CompileAnd.__name__ = command.__name__
|
||||
|
Loading…
Reference in New Issue
Block a user