Skip to content

Commit

Permalink
pipcl.py: fixed doctest.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Oct 16, 2023
1 parent 055f398 commit 3fd64fc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pipcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,16 @@ def assert_str_or_multi( v):
assert_str_or_multi( provides_extra)

# https://packaging.python.org/en/latest/specifications/core-metadata/.
assert re.match('([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$', name, re.IGNORECASE)
assert re.match('([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$', name, re.IGNORECASE), \
f'Bad name: {name!r}'


# PEP-440.
assert re.match(
r'^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$',
version,
)
r'^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$',
version,
), \
f'Bad version: {version!r}.'

# https://packaging.python.org/en/latest/specifications/binary-distribution-format/
if tag_python:
Expand Down Expand Up @@ -1935,6 +1938,8 @@ def run_if( command, out, *prerequisites):
If the output file does not exist, the command is run:
>>> verbose(1)
1
>>> out = 'run_if_test_out'
>>> if os.path.exists( out):
... os.remove( out)
Expand All @@ -1960,9 +1965,7 @@ def run_if( command, out, *prerequisites):
If we repeat, the output will be newer than the prerequisite, so the
command is not run:
>>> verbose_set(2)
>>> run_if( f'touch {out}', out, prerequisite)
pipcl.py: run_if(): Not running command because up to date: 'run_if_test_out'
'''
doit = False
if not doit:
Expand Down Expand Up @@ -2111,13 +2114,13 @@ def verbose(level=None):
return g_verbose

def log0(text=''):
_log(text, 0)
_log(text, 0)

def log1(text=''):
_log(text, 1)
_log(text, 1)

def log2(text=''):
_log(text, 2)
_log(text, 2)

def _log(text, level):
'''
Expand Down

0 comments on commit 3fd64fc

Please sign in to comment.