2008-03-18 14:25:13 -03:00
|
|
|
import os.path
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import reindent
|
|
|
|
|
|
|
|
|
|
|
|
def status(message, modal=False, info=None):
|
|
|
|
"""Decorator to output status info to stdout."""
|
|
|
|
def decorated_fxn(fxn):
|
|
|
|
def call_fxn(*args, **kwargs):
|
|
|
|
sys.stdout.write(message + ' ... ')
|
|
|
|
sys.stdout.flush()
|
|
|
|
result = fxn(*args, **kwargs)
|
|
|
|
if not modal and not info:
|
|
|
|
print "done"
|
|
|
|
elif info:
|
|
|
|
print info(result)
|
|
|
|
else:
|
|
|
|
if result:
|
|
|
|
print "yes"
|
|
|
|
else:
|
|
|
|
print "NO"
|
|
|
|
return result
|
|
|
|
return call_fxn
|
|
|
|
return decorated_fxn
|
|
|
|
|
|
|
|
@status("Getting the list of files that have been added/changed",
|
|
|
|
info=lambda x: "%s files" % len(x))
|
|
|
|
def changed_files():
|
|
|
|
"""Run ``svn status`` and return a set of files that have been
|
|
|
|
changed/added."""
|
|
|
|
cmd = 'svn status --quiet --non-interactive --ignore-externals'
|
|
|
|
svn_st = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
|
|
|
|
svn_st.wait()
|
|
|
|
output = [line.strip() for line in svn_st.stdout.readlines()]
|
|
|
|
files = set()
|
|
|
|
for line in output:
|
|
|
|
if not line[0] in ('A', 'M'):
|
|
|
|
continue
|
|
|
|
line_parts = line.split()
|
|
|
|
path = line_parts[-1]
|
|
|
|
if os.path.isfile(path):
|
|
|
|
files.add(path)
|
|
|
|
return files
|
|
|
|
|
|
|
|
@status("Fixing whitespace", info=lambda x: "%s files" % x)
|
|
|
|
def normalize_whitespace(file_paths):
|
|
|
|
"""Make sure that the whitespace for .py files have been normalized."""
|
|
|
|
reindent.makebackup = False # No need to create backups.
|
|
|
|
result = map(reindent.check, (x for x in file_paths if x.endswith('.py')))
|
|
|
|
return sum(result)
|
|
|
|
|
|
|
|
@status("Docs modified", modal=True)
|
|
|
|
def docs_modified(file_paths):
|
|
|
|
"""Report if any files in the Docs directory."""
|
|
|
|
for path in file_paths:
|
|
|
|
if path.startswith("Doc"):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
@status("Misc/ACKS updated", modal=True)
|
|
|
|
def credit_given(file_paths):
|
|
|
|
"""Check if Misc/ACKS has been changed."""
|
Merged revisions 68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68292 | skip.montanaro | 2009-01-04 11:36:58 +0100 (So, 04 Jan 2009) | 3 lines
If user configures --without-gcc give preference to $CC instead of blindly
assuming the compiler will be "cc".
........
r68344 | marc-andre.lemburg | 2009-01-05 20:43:35 +0100 (Mo, 05 Jan 2009) | 7 lines
Fix #4846 (Py_UNICODE_ISSPACE causes linker error) by moving the declaration
into the extern "C" section.
Add a few more comments and apply some minor edits to make the file contents
fit the original structure again.
........
r68361 | antoine.pitrou | 2009-01-06 19:34:08 +0100 (Di, 06 Jan 2009) | 3 lines
Use shutil.rmtree rather than os.rmdir.
........
r68378 | mark.dickinson | 2009-01-07 18:48:33 +0100 (Mi, 07 Jan 2009) | 2 lines
Issue #4869: clarify documentation for random.expovariate.
........
r68424 | benjamin.peterson | 2009-01-09 03:53:35 +0100 (Fr, 09 Jan 2009) | 1 line
specify what -3 warnings are about
........
r68426 | benjamin.peterson | 2009-01-09 04:03:05 +0100 (Fr, 09 Jan 2009) | 1 line
fix spelling
........
r68429 | benjamin.peterson | 2009-01-09 04:05:14 +0100 (Fr, 09 Jan 2009) | 1 line
add -3 to manpage
........
r68430 | benjamin.peterson | 2009-01-09 04:07:27 +0100 (Fr, 09 Jan 2009) | 1 line
be more specific in -3 option help
........
r68450 | jeffrey.yasskin | 2009-01-09 17:47:07 +0100 (Fr, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68457 | kristjan.jonsson | 2009-01-09 21:10:59 +0100 (Fr, 09 Jan 2009) | 1 line
Issue 3677: Fix import from UNC paths on Windows.
........
r68480 | vinay.sajip | 2009-01-10 14:38:04 +0100 (Sa, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 14:42:04 +0100 (Sa, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 18:18:55 +0100 (Sa, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 18:36:44 +0100 (Sa, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68499 | mark.dickinson | 2009-01-10 20:14:55 +0100 (Sa, 10 Jan 2009) | 2 lines
Remove an unnecessary check from test_decimal.
........
r68501 | vinay.sajip | 2009-01-10 20:22:57 +0100 (Sa, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 23:42:10 +0100 (Sa, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-11 00:41:59 +0100 (So, 11 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-11 00:49:08 +0100 (So, 11 Jan 2009) | 1 line
macos 9 isn't supported
........
2009-01-13 20:00:17 -04:00
|
|
|
return 'Misc/ACKS' in file_paths
|
2008-03-18 14:25:13 -03:00
|
|
|
|
|
|
|
@status("Misc/NEWS updated", modal=True)
|
|
|
|
def reported_news(file_paths):
|
|
|
|
"""Check if Misc/NEWS has been changed."""
|
Merged revisions 68292,68344,68361,68378,68424,68426,68429-68430,68450,68457,68480-68481,68493,68495,68499,68501,68512,68514-68515 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68292 | skip.montanaro | 2009-01-04 11:36:58 +0100 (So, 04 Jan 2009) | 3 lines
If user configures --without-gcc give preference to $CC instead of blindly
assuming the compiler will be "cc".
........
r68344 | marc-andre.lemburg | 2009-01-05 20:43:35 +0100 (Mo, 05 Jan 2009) | 7 lines
Fix #4846 (Py_UNICODE_ISSPACE causes linker error) by moving the declaration
into the extern "C" section.
Add a few more comments and apply some minor edits to make the file contents
fit the original structure again.
........
r68361 | antoine.pitrou | 2009-01-06 19:34:08 +0100 (Di, 06 Jan 2009) | 3 lines
Use shutil.rmtree rather than os.rmdir.
........
r68378 | mark.dickinson | 2009-01-07 18:48:33 +0100 (Mi, 07 Jan 2009) | 2 lines
Issue #4869: clarify documentation for random.expovariate.
........
r68424 | benjamin.peterson | 2009-01-09 03:53:35 +0100 (Fr, 09 Jan 2009) | 1 line
specify what -3 warnings are about
........
r68426 | benjamin.peterson | 2009-01-09 04:03:05 +0100 (Fr, 09 Jan 2009) | 1 line
fix spelling
........
r68429 | benjamin.peterson | 2009-01-09 04:05:14 +0100 (Fr, 09 Jan 2009) | 1 line
add -3 to manpage
........
r68430 | benjamin.peterson | 2009-01-09 04:07:27 +0100 (Fr, 09 Jan 2009) | 1 line
be more specific in -3 option help
........
r68450 | jeffrey.yasskin | 2009-01-09 17:47:07 +0100 (Fr, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68457 | kristjan.jonsson | 2009-01-09 21:10:59 +0100 (Fr, 09 Jan 2009) | 1 line
Issue 3677: Fix import from UNC paths on Windows.
........
r68480 | vinay.sajip | 2009-01-10 14:38:04 +0100 (Sa, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 14:42:04 +0100 (Sa, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 18:18:55 +0100 (Sa, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 18:36:44 +0100 (Sa, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68499 | mark.dickinson | 2009-01-10 20:14:55 +0100 (Sa, 10 Jan 2009) | 2 lines
Remove an unnecessary check from test_decimal.
........
r68501 | vinay.sajip | 2009-01-10 20:22:57 +0100 (Sa, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 23:42:10 +0100 (Sa, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-11 00:41:59 +0100 (So, 11 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-11 00:49:08 +0100 (So, 11 Jan 2009) | 1 line
macos 9 isn't supported
........
2009-01-13 20:00:17 -04:00
|
|
|
return 'Misc/NEWS' in file_paths
|
2008-03-18 14:25:13 -03:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
file_paths = changed_files()
|
|
|
|
# PEP 7/8 verification.
|
|
|
|
normalize_whitespace(file_paths)
|
|
|
|
# Docs updated.
|
|
|
|
docs_modified(file_paths)
|
|
|
|
# Misc/ACKS changed.
|
|
|
|
credit_given(file_paths)
|
|
|
|
# Misc/NEWS changed.
|
|
|
|
reported_news(file_paths)
|
|
|
|
|
|
|
|
# Test suite run and passed.
|
|
|
|
print
|
|
|
|
print "Did you run the test suite?"
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|