Skip to content

Commit 1360fc0

Browse files
committed
bump version, merge branch 'devel'
2 parents a93a157 + 7e34dcf commit 1360fc0

File tree

8 files changed

+56
-30
lines changed

8 files changed

+56
-30
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ before_install:
3535
# fix a crash with multiprocessing on Travis
3636
# - sudo rm -rf /dev/shm
3737
# - sudo ln -s /run/shm /dev/shm
38-
# coverage submission packages
3938
- git fetch --tags
4039
install:
4140
- pip install tox

LICENCE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* files: *
2+
MPLv2.0 2015-2018 (c) Casper da Costa-Luis
3+
[casperdcl](https://github.com/casperdcl).
4+
5+
6+
Mozilla Public Licence (MPL) v. 2.0 - Exhibit A
7+
-----------------------------------------------
8+
9+
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
10+
If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

MANIFEST.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Misc
22
include .coveragerc
3+
include LICENCE
34
include Makefile
4-
include README.rst
55
include tox.ini
66

77
# Test suite
88
recursive-include argopt/tests *.py
99

1010
# Examples/Documentation
11-
recursive-include examples *
11+
recursive-include examples *.py
12+
include README.rst

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
pypi
3434
none
3535

36+
help:
37+
@python setup.py make
38+
3639
alltests:
3740
@+make testcoverage
3841
@+make flake8
@@ -75,10 +78,10 @@ coverclean:
7578
@+python -c "import shutil; shutil.rmtree('argopt/__pycache__', True)"
7679
@+python -c "import shutil; shutil.rmtree('argopt/tests/__pycache__', True)"
7780
clean:
78-
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
79-
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('argopt/*.py[co]')]"
80-
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('examples/*.py[co]')]"
81-
@+python -c "import os; import glob; [os.remove(i) for i in glob.glob('argopt/tests/*.py[co]')]"
81+
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
82+
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('argopt/*.py[co]')]"
83+
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('examples/*.py[co]')]"
84+
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('argopt/tests/*.py[co]')]"
8285
toxclean:
8386
@+python -c "import shutil; shutil.rmtree('.tox', True)"
8487

README.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
argopt
22
======
33

4-
doc to argparse driven by docopt
4+
doc to ``argparse`` driven by ``docopt``
55

66
|PyPI-Status| |PyPI-Versions|
77

@@ -29,7 +29,7 @@ The problem is that this is not always flexible. Still need all the features of
2929
Installation
3030
------------
3131

32-
Latest pypi stable release
32+
Latest PyPI stable release
3333
~~~~~~~~~~~~~~~~~~~~~~~~~~
3434

3535
|PyPI-Status|
@@ -208,7 +208,7 @@ Licence
208208

209209
Open Source (OSI approved): |LICENCE|
210210

211-
Copyright (c) 2016-7 Casper da Costa-Luis.
211+
Copyright (c) 2016-8 Casper da Costa-Luis.
212212

213213
This Source Code Form is subject to the terms of the
214214
Mozilla Public License, v. 2.0.
@@ -223,6 +223,8 @@ Authors
223223

224224
- Casper da Costa-Luis (`@casperdcl <https://github.com/casperdcl/>`__) |Donate|
225225

226+
|argopt-hits|
227+
226228
.. |Build-Status| image:: https://travis-ci.org/casperdcl/argopt.svg?branch=master
227229
:target: https://travis-ci.org/casperdcl/argopt
228230
.. |Coverage-Status| image:: https://coveralls.io/repos/casperdcl/argopt/badge.svg?branch=master
@@ -235,6 +237,7 @@ Authors
235237
:target: https://pypi.python.org/pypi/argopt
236238
.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/argopt.svg
237239
:target: https://pypi.python.org/pypi/argopt
240+
.. |argopt-hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=argopt&a=hidden
238241
.. |OpenHub-Status| image:: https://www.openhub.net/p/arg-opt/widgets/project_thin_badge?format=gif
239242
:target: https://www.openhub.net/p/arg-opt?ref=Thin+badge
240243
.. |LICENCE| image:: https://img.shields.io/pypi/l/argopt.svg

argopt/_docopt.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,25 @@ def parse_defaults(doc):
455455

456456

457457
def printable_usage(doc, section="usage"):
458-
# in python < 2.7 you can't pass flags=re.IGNORECASE
458+
# in python < 2.7 you can't pass flags=re.IGNORECASE|re.MULTILINE
459459
regex = ''.join(["[%s%s]" % (i.lower(), i.upper()) for i in section])
460+
# usage_split = re.split('^(' + regex + ':)', doc, flags=re.M)
460461
usage_split = re.split('(' + regex + ':)', doc)
461-
if len(usage_split) < 3:
462+
# indices of real sections (preceded by newline or blank)
463+
secs = [i + 1 for i in range(0, len(usage_split) - 1, 2) if
464+
usage_split[i].endswith('\n') or not
465+
usage_split[i].strip()]
466+
if len(secs) == 0:
462467
raise DocoptLanguageError(
463468
'"%s:" (case-insensitive) not found.' % section)
464-
if len(usage_split) > 3:
469+
elif len(secs) > 1:
465470
raise DocoptLanguageError(
466471
'More than one "%s:" (case-insensitive).' % section)
472+
# ignore fake sections
473+
s = secs[0]
474+
usage_split = [''.join(usage_split[i]) for i in
475+
[slice(0, s), s, slice(s + 1, None)]]
476+
467477
return re.split(r'\n\s*\n', ''.join(usage_split[1:]))[0].strip()
468478

469479

argopt/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
__all__ = ["__version__"]
1313

1414
# major, minor, patch, -extra
15-
version_info = 0, 3, 5
15+
version_info = 0, 4, 0
1616

1717
# Nice string for the version
1818
__version__ = '.'.join(map(str, version_info))

setup.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
except ImportError:
88
from distutils.core import setup
99
import sys
10-
import subprocess
10+
from subprocess import check_call
11+
from io import open as io_open
12+
1113
# For Makefile parsing
1214
import shlex
1315
try: # pragma: no cover
@@ -17,24 +19,20 @@
1719
# Python 3 compatibility
1820
import configparser as ConfigParser
1921
import io as StringIO
20-
import io
2122
import re
2223

23-
2424
__author__ = None
2525
__licence__ = None
2626
__version__ = None
2727
main_file = os.path.join(os.path.dirname(__file__), 'argopt', '_argopt.py')
28-
for l in io.open(main_file, mode='r'):
28+
for l in io_open(main_file, mode='r'):
2929
if any(l.startswith(i) for i in ('__author__', '__licence__')):
3030
exec(l)
3131
version_file = os.path.join(os.path.dirname(__file__), 'argopt', '_version.py')
32-
with io.open(version_file, mode='r') as fd:
32+
with io_open(version_file, mode='r') as fd:
3333
exec(fd.read())
3434

35-
36-
# # Makefile auxiliary functions # #
37-
35+
# Makefile auxiliary functions #
3836

3937
RE_MAKE_CMD = re.compile('^\t(@\+?)(make)?', flags=re.M)
4038

@@ -50,7 +48,7 @@ def parse_makefile_aliases(filepath):
5048
# -- Parsing the Makefile using ConfigParser
5149
# Adding a fake section to make the Makefile a valid Ini file
5250
ini_str = '[root]\n'
53-
with io.open(filepath, mode='r') as fd:
51+
with io_open(filepath, mode='r') as fd:
5452
ini_str = ini_str + RE_MAKE_CMD.sub('\t', fd.read())
5553
ini_fp = StringIO.StringIO(ini_str)
5654
# Parse using ConfigParser
@@ -126,16 +124,17 @@ def execute_makefile_commands(commands, alias, verbose=False):
126124
if verbose:
127125
print("Running command: " + cmd)
128126
# Launch the command and wait to finish (synchronized call)
129-
subprocess.check_call(parsed_cmd)
127+
check_call(parsed_cmd,
128+
cwd=os.path.dirname(os.path.abspath(__file__)))
130129

131130

132-
# # Main setup.py config # #
131+
# Main setup.py config #
133132

134133

135134
# Executing makefile commands if specified
136135
if sys.argv[1].lower().strip() == 'make':
137136
# Filename of the makefile
138-
fpath = 'Makefile'
137+
fpath = os.path.join(os.path.dirname(__file__), 'Makefile')
139138
# Parse the makefile, substitute the aliases and extract the commands
140139
commands = parse_makefile_aliases(fpath)
141140

@@ -162,11 +161,11 @@ def execute_makefile_commands(commands, alias, verbose=False):
162161
sys.exit(0)
163162

164163

165-
# # Python package config # #
166-
164+
# Python package config #
167165

168-
README_rst = None
169-
with io.open('README.rst', mode='r', encoding='utf-8') as fd:
166+
README_rst = ''
167+
fndoc = os.path.join(os.path.dirname(__file__), 'README.rst')
168+
with io_open(fndoc, mode='r', encoding='utf-8') as fd:
170169
README_rst = fd.read()
171170

172171
setup(
@@ -182,6 +181,7 @@ def execute_makefile_commands(commands, alias, verbose=False):
182181
platforms=['any'],
183182
packages=['argopt'],
184183
install_requires=['argparse'],
184+
package_data={'': ['LICENCE']},
185185
classifiers=[
186186
# Trove classifiers
187187
# (https://pypi.python.org/pypi?%3Aaction=list_classifiers)

0 commit comments

Comments
 (0)