mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Update scripts
This commit is contained in:
@ -6,6 +6,8 @@ import errno, os, shutil, sys, tempfile
|
|||||||
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
|
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
|
versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0']
|
||||||
|
|
||||||
def pip_install(package, commit=None, **kwargs):
|
def pip_install(package, commit=None, **kwargs):
|
||||||
"Install package using pip."
|
"Install package using pip."
|
||||||
min_version = kwargs.get('min_version')
|
min_version = kwargs.get('min_version')
|
||||||
@ -93,11 +95,11 @@ def build_docs(version='dev', **kwargs):
|
|||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise CalledProcessError(p.returncode, cmd)
|
raise CalledProcessError(p.returncode, cmd)
|
||||||
html_dir = os.path.join(work_dir, 'html')
|
html_dir = os.path.join(work_dir, 'html')
|
||||||
versions = ['3.0.0', '2.0.0', '1.1.0']
|
main_versions = reversed(versions[-3:])
|
||||||
check_call(['sphinx-build',
|
check_call(['sphinx-build',
|
||||||
'-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir),
|
'-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir),
|
||||||
'-Dversion=' + version, '-Drelease=' + version,
|
'-Dversion=' + version, '-Drelease=' + version,
|
||||||
'-Aversion=' + version, '-Aversions=' + ','.join(versions),
|
'-Aversion=' + version, '-Aversions=' + ','.join(main_versions),
|
||||||
'-b', 'html', doc_dir, html_dir])
|
'-b', 'html', doc_dir, html_dir])
|
||||||
try:
|
try:
|
||||||
check_call(['lessc', '--clean-css',
|
check_call(['lessc', '--clean-css',
|
||||||
|
@ -8,7 +8,7 @@ Usage:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import datetime, docopt, fileinput, json, os
|
import datetime, docopt, errno, fileinput, json, os
|
||||||
import re, requests, shutil, sys, tempfile
|
import re, requests, shutil, sys, tempfile
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
@ -80,6 +80,7 @@ def create_build_env():
|
|||||||
import build
|
import build
|
||||||
|
|
||||||
env.build_dir = 'build'
|
env.build_dir = 'build'
|
||||||
|
env.versions = build.versions
|
||||||
|
|
||||||
# Virtualenv and repos are cached to speed up builds.
|
# Virtualenv and repos are cached to speed up builds.
|
||||||
build.create_build_env(os.path.join(env.build_dir, 'virtualenv'))
|
build.create_build_env(os.path.join(env.build_dir, 'virtualenv'))
|
||||||
@ -113,7 +114,7 @@ def update_site(env):
|
|||||||
doc_repo = Git(os.path.join(env.build_dir, 'fmtlib.github.io'))
|
doc_repo = Git(os.path.join(env.build_dir, 'fmtlib.github.io'))
|
||||||
doc_repo.update('git@github.com:fmtlib/fmtlib.github.io')
|
doc_repo.update('git@github.com:fmtlib/fmtlib.github.io')
|
||||||
|
|
||||||
for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0']:
|
for version in env.versions:
|
||||||
clean_checkout(env.fmt_repo, version)
|
clean_checkout(env.fmt_repo, version)
|
||||||
target_doc_dir = os.path.join(env.fmt_repo.dir, 'doc')
|
target_doc_dir = os.path.join(env.fmt_repo.dir, 'doc')
|
||||||
# Remove the old theme.
|
# Remove the old theme.
|
||||||
@ -165,7 +166,11 @@ def update_site(env):
|
|||||||
os.symlink(target, link)
|
os.symlink(target, link)
|
||||||
# Copy docs to the website.
|
# Copy docs to the website.
|
||||||
version_doc_dir = os.path.join(doc_repo.dir, version)
|
version_doc_dir = os.path.join(doc_repo.dir, version)
|
||||||
shutil.rmtree(version_doc_dir)
|
try:
|
||||||
|
shutil.rmtree(version_doc_dir)
|
||||||
|
except OSError as e:
|
||||||
|
if e.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
shutil.move(html_dir, version_doc_dir)
|
shutil.move(html_dir, version_doc_dir)
|
||||||
|
|
||||||
|
|
||||||
@ -205,13 +210,13 @@ def release(args):
|
|||||||
title_len = 0
|
title_len = 0
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
|
|
||||||
# Add the version to the script.
|
# Add the version to the build script.
|
||||||
script = os.path.join('support', 'manage.py')
|
script = os.path.join('doc', 'build.py')
|
||||||
script_path = os.path.join(fmt_repo.dir, script)
|
script_path = os.path.join(fmt_repo.dir, script)
|
||||||
for line in fileinput.input(script_path, inplace=True):
|
for line in fileinput.input(script_path, inplace=True):
|
||||||
m = re.match(r'( *for version in )\[(.+)\]:', line)
|
m = re.match(r'( *versions = )\[(.+)\]', line)
|
||||||
if m:
|
if m:
|
||||||
line = '{}[{}, \'{}\']:\n'.format(m.group(1), m.group(2), version)
|
line = '{}[{}, \'{}\']\n'.format(m.group(1), m.group(2), version)
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
|
|
||||||
fmt_repo.checkout('-B', 'release')
|
fmt_repo.checkout('-B', 'release')
|
||||||
|
Reference in New Issue
Block a user