mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
3ae27e38f3
commit
16b94a79ef
@ -25,6 +25,7 @@ isdragonflybsd = 'dragonfly' in sys.platform
|
||||
isbsd = isnetbsd or isfreebsd or isdragonflybsd
|
||||
ishaiku = 'haiku1' in sys.platform
|
||||
islinux = not ismacos and not iswindows and not isbsd and not ishaiku
|
||||
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||
sys.setup_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
SRC = os.path.abspath(os.path.join(os.path.dirname(sys.setup_dir), 'src'))
|
||||
sys.path.insert(0, SRC)
|
||||
@ -69,7 +70,7 @@ def download_securely(url):
|
||||
# We use curl here as on some OSes (OS X) when bootstrapping calibre,
|
||||
# python will be unable to validate certificates until after cacerts is
|
||||
# installed
|
||||
if os.environ.get('CI') and iswindows:
|
||||
if is_ci and iswindows:
|
||||
# curl is failing for wikipedia urls on CI (used for browser_data)
|
||||
from urllib.request import urlopen
|
||||
return urlopen(url).read()
|
||||
@ -211,7 +212,7 @@ class Command:
|
||||
|
||||
def running(self, cmd):
|
||||
from setup.commands import command_names
|
||||
if os.environ.get('CI'):
|
||||
if is_ci:
|
||||
self.info('::group::' + command_names[cmd])
|
||||
self.info('\n*')
|
||||
self.info('* Running', command_names[cmd])
|
||||
@ -227,7 +228,7 @@ class Command:
|
||||
self.running(cmd)
|
||||
cmd.run(opts)
|
||||
self.info(f'* {command_names[cmd]} took {time.time() - st:.1f} seconds')
|
||||
if os.environ.get('CI'):
|
||||
if is_ci:
|
||||
self.info('::endgroup::')
|
||||
|
||||
def run_all(self, opts):
|
||||
|
@ -7,7 +7,6 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, re, shutil, zipfile, glob, json, errno
|
||||
from zlib import compress
|
||||
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||
|
||||
from setup import Command, basenames, __appname__, download_securely, dump_json
|
||||
from polyglot.builtins import codepoint_to_chr, itervalues, iteritems, only_unicode_recursive
|
||||
|
@ -7,9 +7,7 @@ import tarfile
|
||||
import time
|
||||
from io import BytesIO
|
||||
|
||||
from setup import Command, download_securely
|
||||
|
||||
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||
from setup import Command, download_securely, is_ci
|
||||
|
||||
|
||||
class ReVendor(Command):
|
||||
|
@ -10,10 +10,9 @@ from collections import defaultdict
|
||||
from locale import normalize as normalize_locale
|
||||
from functools import partial
|
||||
|
||||
from setup import Command, __appname__, __version__, require_git_master, build_cache_dir, edit_file, dump_json
|
||||
from setup import Command, __appname__, __version__, require_git_master, build_cache_dir, edit_file, dump_json, is_ci
|
||||
from setup.parallel_build import batched_parallel_jobs
|
||||
from polyglot.builtins import codepoint_to_chr, iteritems
|
||||
is_ci = os.environ.get('CI', '').lower() == 'true'
|
||||
|
||||
|
||||
def qt_sources():
|
||||
|
Loading…
x
Reference in New Issue
Block a user