Merged revisions 61520,61523-61528,61532 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61520 | thomas.heller | 2008-03-18 16:03:17 +0100 (Di, 18 Mär 2008) | 5 lines
Include <alloca.h> on Solaris, see issue #1506.
It would probably be better to have a configure test for that, but
this is outside of my configure expertise.
........
r61523 | brett.cannon | 2008-03-18 16:35:58 +0100 (Di, 18 Mär 2008) | 5 lines
Remove all traces of HAVE_STRERROR.
The removal of strerror.c led to the function check being removed from
configure.in.
........
r61524 | brett.cannon | 2008-03-18 16:52:00 +0100 (Di, 18 Mär 2008) | 2 lines
Fix test_errno to only check for error numbers that are defined by Standard C.
........
r61525 | steven.bethard | 2008-03-18 17:00:19 +0100 (Di, 18 Mär 2008) | 1 line
Use test_support.unlink instead of os.unlink in tearDown(). (Seems to fix an occasional failure in Windows Vista.)
........
r61526 | brett.cannon | 2008-03-18 17:47:51 +0100 (Di, 18 Mär 2008) | 3 lines
Cast the arguments to PyString_AsStringAndSize() to silence compiler warnings
on OS X.
........
r61527 | sean.reifschneider | 2008-03-18 18:24:12 +0100 (Di, 18 Mär 2008) | 3 lines
Issue 1577: shutil.move() where destination is a directory was doing a
copy, now it is doing a os.rename() if it's on the same file-system.
........
r61528 | brett.cannon | 2008-03-18 18:25:13 +0100 (Di, 18 Mär 2008) | 12 lines
Add Tools/scripts/patchcheck.py. Invoked from ``make check``, the script does
some verification:
- Runs reindent.py on all .py files.
- Checks if any changes in Doc exist.
- Whether Misc/ACKS was changed.
- Whether Misc/NEWS was changed.
The hope is that ``make check`` can become a command anybody can run to get
reminders about what all the requisite steps needed to create a proper
patch/checkin.
........
r61532 | neal.norwitz | 2008-03-18 18:58:02 +0100 (Di, 18 Mär 2008) | 1 line
Get regrtest working when re-running tests
........
2008-03-18 15:26:33 -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()
|
2008-03-18 18:45:57 -03:00
|
|
|
output = [x.decode().rstrip() for x in svn_st.stdout.readlines()]
|
Merged revisions 61520,61523-61528,61532 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61520 | thomas.heller | 2008-03-18 16:03:17 +0100 (Di, 18 Mär 2008) | 5 lines
Include <alloca.h> on Solaris, see issue #1506.
It would probably be better to have a configure test for that, but
this is outside of my configure expertise.
........
r61523 | brett.cannon | 2008-03-18 16:35:58 +0100 (Di, 18 Mär 2008) | 5 lines
Remove all traces of HAVE_STRERROR.
The removal of strerror.c led to the function check being removed from
configure.in.
........
r61524 | brett.cannon | 2008-03-18 16:52:00 +0100 (Di, 18 Mär 2008) | 2 lines
Fix test_errno to only check for error numbers that are defined by Standard C.
........
r61525 | steven.bethard | 2008-03-18 17:00:19 +0100 (Di, 18 Mär 2008) | 1 line
Use test_support.unlink instead of os.unlink in tearDown(). (Seems to fix an occasional failure in Windows Vista.)
........
r61526 | brett.cannon | 2008-03-18 17:47:51 +0100 (Di, 18 Mär 2008) | 3 lines
Cast the arguments to PyString_AsStringAndSize() to silence compiler warnings
on OS X.
........
r61527 | sean.reifschneider | 2008-03-18 18:24:12 +0100 (Di, 18 Mär 2008) | 3 lines
Issue 1577: shutil.move() where destination is a directory was doing a
copy, now it is doing a os.rename() if it's on the same file-system.
........
r61528 | brett.cannon | 2008-03-18 18:25:13 +0100 (Di, 18 Mär 2008) | 12 lines
Add Tools/scripts/patchcheck.py. Invoked from ``make check``, the script does
some verification:
- Runs reindent.py on all .py files.
- Checks if any changes in Doc exist.
- Whether Misc/ACKS was changed.
- Whether Misc/NEWS was changed.
The hope is that ``make check`` can become a command anybody can run to get
reminders about what all the requisite steps needed to create a proper
patch/checkin.
........
r61532 | neal.norwitz | 2008-03-18 18:58:02 +0100 (Di, 18 Mär 2008) | 1 line
Get regrtest working when re-running tests
........
2008-03-18 15:26:33 -03:00
|
|
|
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 = list(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."""
|
|
|
|
return True if 'Misc/ACKS' in file_paths else False
|
|
|
|
|
|
|
|
@status("Misc/NEWS updated", modal=True)
|
|
|
|
def reported_news(file_paths):
|
|
|
|
"""Check if Misc/NEWS has been changed."""
|
|
|
|
return True if 'Misc/NEWS' in file_paths else False
|
|
|
|
|
|
|
|
|
|
|
|
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()
|