Don't build admin app on readthedocs

This commit is contained in:
Simon Li
2022-05-29 19:23:57 +01:00
parent 0b161627c2
commit 7d7d30bcae

View File

@@ -270,16 +270,20 @@ class JSX(BaseCommand):
js_target = pjoin(static, 'js', 'admin-react.js') js_target = pjoin(static, 'js', 'admin-react.js')
def should_run(self): def should_run(self):
update_needed = False if os.getenv('READTHEDOCS'):
# yarn not available on RTD
return False
if not os.path.exists(self.js_target): if not os.path.exists(self.js_target):
update_needed = True return True
else:
js_target_mtime = mtime(self.js_target) js_target_mtime = mtime(self.js_target)
# The sdist doesn't contain the jsx directory so this always returns 0: # The sdist doesn't contain the jsx directory so this always returns 0
jsx_mtime = recursive_mtime(self.jsx_dir) # if run from the dist/*.tar.gz
if js_target_mtime < jsx_mtime: jsx_mtime = recursive_mtime(self.jsx_dir)
update_needed = True if js_target_mtime < jsx_mtime:
return update_needed return True
return False
def run(self): def run(self):
if not self.should_run(): if not self.should_run():