1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-07 23:33:52 +00:00

Py 2 compat

This commit is contained in:
Henry Fredrick Schreiner 2017-02-06 12:12:40 -05:00
parent dc0747ffc2
commit 6f30770038
2 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,5 @@
language: python
language: cpp
sudo: false
python:
- "3.6"
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps/cmake
@ -29,6 +27,7 @@ matrix:
- compiler: clang
install:
- echo "Python version: " && python -c 'import sys; print(sys.version_info[:])'
- if [ "$CXX" = "g++" ]; then export CXX="g++-$COMPILER" CC="gcc-$COMPILER"; fi
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
@ -42,6 +41,7 @@ install:
- export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
- cd "${DEPS_DIR}"
- [[ $(python -c 'import sys; print(sys.version_info[0])') == 2 ]] && pip install pathlib
script:
- cd "${TRAVIS_BUILD_DIR}"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
# Requires Python 3.6
# Requires pathlib on python 2
import re
import argparse
@ -26,12 +26,12 @@ def MakeHeader(out):
with (BDIR / inc).open() as f:
inner = f.read()
headers |= set(includes_system.findall(inner))
output += f'\n// From {inc}\n\n'
output += '\n// From {inc}\n\n'.format(inc=inc)
output += inner[inner.find('namespace'):]
header_list = '\n'.join(f'#include <{h}>' for h in headers)
header_list = '\n'.join(f'#include <'+h+'>' for h in headers)
output = f'''\
output = '''\
#pragma once
// Distributed under the LGPL version 3.0 license. See accompanying
@ -41,12 +41,12 @@ def MakeHeader(out):
// This has the complete CLI library in one file.
{header_list}
{output}'''
{output}'''.format(header_list=header_list, output=output)
with Path(out).open('w') as f:
f.write(output)
print(f"Created {out}")
print("Created {out}".format(out=out))
if __name__ == '__main__':