mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 14:42:25 +00:00
Format scripts
This commit is contained in:
parent
e9a0d3141b
commit
41356aa00a
@ -13,7 +13,8 @@ if build == 'mingw':
|
|||||||
cmake_command.append('-GMinGW Makefiles')
|
cmake_command.append('-GMinGW Makefiles')
|
||||||
build_command = ['mingw32-make', '-j4']
|
build_command = ['mingw32-make', '-j4']
|
||||||
test_command = ['mingw32-make', 'test']
|
test_command = ['mingw32-make', 'test']
|
||||||
# Remove the path to Git bin directory from $PATH because it breaks MinGW config.
|
# Remove the path to Git bin directory from $PATH because it breaks
|
||||||
|
# MinGW config.
|
||||||
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
|
path = path.replace(r'C:\Program Files (x86)\Git\bin', '')
|
||||||
os.environ['PATH'] = r'C:\MinGW\bin;' + path
|
os.environ['PATH'] = r'C:\MinGW\bin;' + path
|
||||||
else:
|
else:
|
||||||
|
@ -19,21 +19,15 @@ def makedirs_if_not_exist(dir):
|
|||||||
if e.errno != errno.EEXIST:
|
if e.errno != errno.EEXIST:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
def install_dependencies():
|
||||||
|
|
||||||
build = os.environ['BUILD']
|
|
||||||
if build == 'Doc':
|
|
||||||
travis = 'TRAVIS' in os.environ
|
|
||||||
# Install dependencies.
|
|
||||||
if travis:
|
|
||||||
branch = os.environ['TRAVIS_BRANCH']
|
branch = os.environ['TRAVIS_BRANCH']
|
||||||
if branch != 'master':
|
if branch != 'master':
|
||||||
print('Branch: ' + branch)
|
print('Branch: ' + branch)
|
||||||
exit(0) # Ignore non-master branches
|
exit(0) # Ignore non-master branches
|
||||||
check_call('curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | ' +
|
check_call('curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key ' +
|
||||||
'sudo apt-key add -', shell=True)
|
'| sudo apt-key add -', shell=True)
|
||||||
check_call('echo "deb https://deb.nodesource.com/node_0.10 precise main" | ' +
|
check_call('echo "deb https://deb.nodesource.com/node_0.10 precise main" ' +
|
||||||
'sudo tee /etc/apt/sources.list.d/nodesource.list', shell=True)
|
'| sudo tee /etc/apt/sources.list.d/nodesource.list', shell=True)
|
||||||
check_call(['sudo', 'apt-get', 'update'])
|
check_call(['sudo', 'apt-get', 'update'])
|
||||||
check_call(['sudo', 'apt-get', 'install', 'python-virtualenv', 'nodejs'])
|
check_call(['sudo', 'apt-get', 'install', 'python-virtualenv', 'nodejs'])
|
||||||
check_call(['npm', 'install', '-g', 'less', 'less-plugin-clean-css'])
|
check_call(['npm', 'install', '-g', 'less', 'less-plugin-clean-css'])
|
||||||
@ -41,14 +35,22 @@ if build == 'Doc':
|
|||||||
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
|
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
|
||||||
deb_file, deb_file)
|
deb_file, deb_file)
|
||||||
check_call(['sudo', 'dpkg', '-i', deb_file])
|
check_call(['sudo', 'dpkg', '-i', deb_file])
|
||||||
|
|
||||||
|
fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
|
build = os.environ['BUILD']
|
||||||
|
if build == 'Doc':
|
||||||
|
travis = 'TRAVIS' in os.environ
|
||||||
|
if travis:
|
||||||
|
install_dependencies()
|
||||||
sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
|
sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
|
||||||
import build
|
import build
|
||||||
build.create_build_env()
|
build.create_build_env()
|
||||||
html_dir = build.build_docs()
|
html_dir = build.build_docs()
|
||||||
repo = 'fmtlib.github.io'
|
repo = 'fmtlib.github.io'
|
||||||
if travis and 'KEY' not in os.environ:
|
if travis and 'KEY' not in os.environ:
|
||||||
# Don't update the repo if building on Travis from an account that doesn't
|
# Don't update the repo if building on Travis from an account that
|
||||||
# have push access.
|
# doesn't have push access.
|
||||||
print('Skipping update of ' + repo)
|
print('Skipping update of ' + repo)
|
||||||
exit(0)
|
exit(0)
|
||||||
# Clone the fmtlib.github.io repo.
|
# Clone the fmtlib.github.io repo.
|
||||||
@ -88,7 +90,9 @@ common_cmake_flags = [
|
|||||||
]
|
]
|
||||||
extra_cmake_flags = []
|
extra_cmake_flags = []
|
||||||
if standard != '0x':
|
if standard != '0x':
|
||||||
extra_cmake_flags = ['-DCMAKE_CXX_FLAGS=-std=c++' + standard, '-DFMT_USE_CPP11=OFF']
|
extra_cmake_flags = [
|
||||||
|
'-DCMAKE_CXX_FLAGS=-std=c++' + standard, '-DFMT_USE_CPP11=OFF'
|
||||||
|
]
|
||||||
check_call(['cmake', '-DFMT_DOC=OFF', '-DFMT_PEDANTIC=ON', fmt_dir] +
|
check_call(['cmake', '-DFMT_DOC=OFF', '-DFMT_PEDANTIC=ON', fmt_dir] +
|
||||||
common_cmake_flags + extra_cmake_flags, cwd=build_dir)
|
common_cmake_flags + extra_cmake_flags, cwd=build_dir)
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.0']:
|
|||||||
with open(reference) as f:
|
with open(reference) as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
data = data.replace('std::ostream &', 'std::ostream&')
|
data = data.replace('std::ostream &', 'std::ostream&')
|
||||||
data = re.sub(re.compile('doxygenfunction.. (bin|oct|hexu|hex)$', re.MULTILINE),
|
pat = re.compile('doxygenfunction.. (bin|oct|hexu|hex)$', re.MULTILINE)
|
||||||
r'doxygenfunction:: \1(int)', data)
|
data = re.sub(pat, r'doxygenfunction:: \1(int)', data)
|
||||||
data = data.replace('std::FILE*', 'std::FILE *')
|
data = data.replace('std::FILE*', 'std::FILE *')
|
||||||
data = data.replace('unsigned int', 'unsigned')
|
data = data.replace('unsigned int', 'unsigned')
|
||||||
with open(reference, 'w') as f:
|
with open(reference, 'w') as f:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user