mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Command to vendor csslint
This commit is contained in:
parent
c842e34589
commit
f686647286
10898
resources/csslint.js
Normal file
10898
resources/csslint.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,7 @@ __all__ = [
|
||||
'upload_user_manual', 'upload_demo', 'reupload',
|
||||
'stage1', 'stage2', 'stage3', 'stage4', 'stage5', 'publish', 'publish_betas',
|
||||
'linux', 'linux32', 'linux64', 'win', 'win32', 'win64', 'osx', 'build_dep',
|
||||
'export_packages', 'hyphenation'
|
||||
'export_packages', 'hyphenation', 'csslint'
|
||||
]
|
||||
|
||||
from setup.installers import Linux, Win, OSX, Linux32, Linux64, Win32, Win64, ExtDev, BuildDep, ExportPackages
|
||||
@ -39,6 +39,9 @@ get_translations = GetTranslations()
|
||||
iso639 = ISO639()
|
||||
iso3166 = ISO3166()
|
||||
|
||||
from setup.csslint import CSSLint
|
||||
csslint = CSSLint()
|
||||
|
||||
from setup.build import Build
|
||||
build = Build()
|
||||
|
||||
|
37
setup/csslint.py
Normal file
37
setup/csslint.py
Normal file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPL v3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from setup import Command
|
||||
|
||||
|
||||
class CSSLint(Command):
|
||||
# We cant use the released copy since it has not had a release in years and
|
||||
# there are several critical bug fixes we need
|
||||
|
||||
description = 'Update the bundled copy of csslint'
|
||||
NAME = 'csslint.js'
|
||||
DOWNLOAD_URL = 'https://github.com/CSSLint/csslint.git'
|
||||
|
||||
@property
|
||||
def vendored_file(self):
|
||||
return os.path.join(self.RESOURCES, self.NAME)
|
||||
|
||||
def run(self, opts):
|
||||
self.clean()
|
||||
|
||||
with self.temp_dir() as dl_src:
|
||||
subprocess.check_call(['git', 'clone', '--depth=1', self.DOWNLOAD_URL], cwd=dl_src)
|
||||
src = self.j(dl_src, 'csslint')
|
||||
subprocess.check_call(['npm', 'install'], cwd=src)
|
||||
shutil.copyfile(self.j(src, 'dist', self.NAME), self.vendored_file)
|
||||
|
||||
def clean(self):
|
||||
if os.path.exists(self.vendored_file):
|
||||
os.remove(self.vendored_file)
|
Loading…
x
Reference in New Issue
Block a user