2011-07-26 13:01:08 -03:00
|
|
|
#!/usr/bin/env python3
|
2017-06-24 20:51:23 -03:00
|
|
|
"""Check proposed changes for common issues."""
|
2010-10-21 09:49:28 -03:00
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
import shutil
|
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
|
2011-07-30 16:34:04 -03:00
|
|
|
import sysconfig
|
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 reindent
|
2010-10-21 09:49:28 -03:00
|
|
|
import untabify
|
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
|
|
|
|
|
|
|
|
2017-08-17 11:29:15 -03:00
|
|
|
# Excluded directories which are copies of external libraries:
|
|
|
|
# don't check their coding style
|
2022-12-28 15:38:52 -04:00
|
|
|
EXCLUDE_DIRS = [
|
|
|
|
os.path.join('Modules', '_decimal', 'libmpdec'),
|
|
|
|
os.path.join('Modules', 'expat'),
|
|
|
|
os.path.join('Modules', 'zlib'),
|
|
|
|
]
|
2011-07-30 16:34:04 -03:00
|
|
|
SRCDIR = sysconfig.get_config_var('srcdir')
|
|
|
|
|
2017-08-17 11:29:15 -03:00
|
|
|
|
2010-07-04 19:05:34 -03:00
|
|
|
def n_files_str(count):
|
|
|
|
"""Return 'N file(s)' with the proper plurality on 'file'."""
|
|
|
|
return "{} file{}".format(count, "s" if count != 1 else "")
|
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
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
|
|
|
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:
|
2010-08-09 09:24:20 -03:00
|
|
|
print("yes" if result else "NO")
|
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
|
|
|
return result
|
|
|
|
return call_fxn
|
|
|
|
return decorated_fxn
|
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
2017-03-11 23:19:08 -04:00
|
|
|
def get_git_branch():
|
|
|
|
"""Get the symbolic name for the current git branch"""
|
|
|
|
cmd = "git rev-parse --abbrev-ref HEAD".split()
|
|
|
|
try:
|
2018-10-19 21:49:41 -03:00
|
|
|
return subprocess.check_output(cmd,
|
|
|
|
stderr=subprocess.DEVNULL,
|
2021-05-10 15:34:27 -03:00
|
|
|
cwd=SRCDIR,
|
|
|
|
encoding='UTF-8')
|
2017-03-11 23:19:08 -04:00
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def get_git_upstream_remote():
|
|
|
|
"""Get the remote name to use for upstream branches
|
|
|
|
|
|
|
|
Uses "upstream" if it exists, "origin" otherwise
|
|
|
|
"""
|
|
|
|
cmd = "git remote get-url upstream".split()
|
|
|
|
try:
|
2018-10-19 21:49:41 -03:00
|
|
|
subprocess.check_output(cmd,
|
|
|
|
stderr=subprocess.DEVNULL,
|
2021-05-10 15:34:27 -03:00
|
|
|
cwd=SRCDIR,
|
|
|
|
encoding='UTF-8')
|
2017-03-11 23:19:08 -04:00
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
return "origin"
|
|
|
|
return "upstream"
|
|
|
|
|
|
|
|
|
2021-05-10 15:34:27 -03:00
|
|
|
def get_git_remote_default_branch(remote_name):
|
|
|
|
"""Get the name of the default branch for the given remote
|
|
|
|
|
|
|
|
It is typically called 'main', but may differ
|
|
|
|
"""
|
|
|
|
cmd = "git remote show {}".format(remote_name).split()
|
2021-05-13 14:48:15 -03:00
|
|
|
env = os.environ.copy()
|
|
|
|
env['LANG'] = 'C'
|
2021-05-10 15:34:27 -03:00
|
|
|
try:
|
|
|
|
remote_info = subprocess.check_output(cmd,
|
|
|
|
stderr=subprocess.DEVNULL,
|
|
|
|
cwd=SRCDIR,
|
2021-05-13 14:48:15 -03:00
|
|
|
encoding='UTF-8',
|
|
|
|
env=env)
|
2021-05-10 15:34:27 -03:00
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
return None
|
|
|
|
for line in remote_info.splitlines():
|
|
|
|
if "HEAD branch:" in line:
|
|
|
|
base_branch = line.split(":")[1].strip()
|
|
|
|
return base_branch
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
2017-03-11 23:19:08 -04:00
|
|
|
@status("Getting base branch for PR",
|
|
|
|
info=lambda x: x if x is not None else "not a PR branch")
|
|
|
|
def get_base_branch():
|
2017-04-09 05:33:03 -03:00
|
|
|
if not os.path.exists(os.path.join(SRCDIR, '.git')):
|
2017-03-11 23:19:08 -04:00
|
|
|
# Not a git checkout, so there's no base branch
|
|
|
|
return None
|
2021-05-10 15:34:27 -03:00
|
|
|
upstream_remote = get_git_upstream_remote()
|
2017-03-11 23:19:08 -04:00
|
|
|
version = sys.version_info
|
|
|
|
if version.releaselevel == 'alpha':
|
2021-05-10 15:34:27 -03:00
|
|
|
base_branch = get_git_remote_default_branch(upstream_remote)
|
2017-03-11 23:19:08 -04:00
|
|
|
else:
|
|
|
|
base_branch = "{0.major}.{0.minor}".format(version)
|
|
|
|
this_branch = get_git_branch()
|
|
|
|
if this_branch is None or this_branch == base_branch:
|
|
|
|
# Not on a git PR branch, so there's no base branch
|
|
|
|
return None
|
|
|
|
return upstream_remote + "/" + base_branch
|
|
|
|
|
|
|
|
|
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
|
|
|
@status("Getting the list of files that have been added/changed",
|
2010-10-21 09:49:28 -03:00
|
|
|
info=lambda x: n_files_str(len(x)))
|
2017-03-11 23:19:08 -04:00
|
|
|
def changed_files(base_branch=None):
|
2018-06-06 02:40:12 -03:00
|
|
|
"""Get the list of changed or added files from git."""
|
|
|
|
if os.path.exists(os.path.join(SRCDIR, '.git')):
|
2017-03-12 06:37:09 -03:00
|
|
|
# We just use an existence check here as:
|
|
|
|
# directory = normal git checkout/clone
|
|
|
|
# file = git worktree directory
|
2017-03-11 23:19:08 -04:00
|
|
|
if base_branch:
|
|
|
|
cmd = 'git diff --name-status ' + base_branch
|
|
|
|
else:
|
|
|
|
cmd = 'git status --porcelain'
|
2015-04-23 06:24:14 -03:00
|
|
|
filenames = []
|
2018-10-19 21:49:41 -03:00
|
|
|
with subprocess.Popen(cmd.split(),
|
|
|
|
stdout=subprocess.PIPE,
|
|
|
|
cwd=SRCDIR) as st:
|
2022-03-14 10:28:57 -03:00
|
|
|
if st.wait() != 0:
|
|
|
|
sys.exit(f'error running {cmd}')
|
2015-04-23 06:24:14 -03:00
|
|
|
for line in st.stdout:
|
|
|
|
line = line.decode().rstrip()
|
2017-03-11 23:19:08 -04:00
|
|
|
status_text, filename = line.split(maxsplit=1)
|
|
|
|
status = set(status_text)
|
2015-04-23 06:24:14 -03:00
|
|
|
# modified, added or unmerged files
|
|
|
|
if not status.intersection('MAU'):
|
|
|
|
continue
|
|
|
|
if ' -> ' in filename:
|
|
|
|
# file is renamed
|
|
|
|
filename = filename.split(' -> ', 2)[1].strip()
|
|
|
|
filenames.append(filename)
|
|
|
|
else:
|
2018-06-06 02:40:12 -03:00
|
|
|
sys.exit('need a git checkout to get modified files')
|
2010-08-09 09:24:20 -03:00
|
|
|
|
2017-08-17 11:29:15 -03:00
|
|
|
filenames2 = []
|
|
|
|
for filename in filenames:
|
|
|
|
# Normalize the path to be able to match using .startswith()
|
|
|
|
filename = os.path.normpath(filename)
|
|
|
|
if any(filename.startswith(path) for path in EXCLUDE_DIRS):
|
|
|
|
# Exclude the file
|
|
|
|
continue
|
|
|
|
filenames2.append(filename)
|
|
|
|
|
|
|
|
return filenames2
|
|
|
|
|
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
|
|
|
|
2010-07-04 19:05:34 -03:00
|
|
|
def report_modified_files(file_paths):
|
|
|
|
count = len(file_paths)
|
|
|
|
if count == 0:
|
|
|
|
return n_files_str(count)
|
|
|
|
else:
|
|
|
|
lines = ["{}:".format(n_files_str(count))]
|
|
|
|
for path in file_paths:
|
|
|
|
lines.append(" {}".format(path))
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
2017-06-24 20:51:23 -03:00
|
|
|
@status("Fixing Python file whitespace", info=report_modified_files)
|
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
|
|
|
def normalize_whitespace(file_paths):
|
|
|
|
"""Make sure that the whitespace for .py files have been normalized."""
|
|
|
|
reindent.makebackup = False # No need to create backups.
|
2011-06-27 20:25:06 -03:00
|
|
|
fixed = [path for path in file_paths if path.endswith('.py') and
|
2011-07-31 13:33:00 -03:00
|
|
|
reindent.check(os.path.join(SRCDIR, path))]
|
2010-07-04 19:05:34 -03:00
|
|
|
return fixed
|
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
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
2010-10-21 09:49:28 -03:00
|
|
|
@status("Fixing C file whitespace", info=report_modified_files)
|
|
|
|
def normalize_c_whitespace(file_paths):
|
|
|
|
"""Report if any C files """
|
|
|
|
fixed = []
|
|
|
|
for path in file_paths:
|
2011-07-30 16:34:04 -03:00
|
|
|
abspath = os.path.join(SRCDIR, path)
|
|
|
|
with open(abspath, 'r') as f:
|
2010-10-21 09:49:28 -03:00
|
|
|
if '\t' not in f.read():
|
|
|
|
continue
|
2011-07-30 16:34:04 -03:00
|
|
|
untabify.process(abspath, 8, verbose=False)
|
2010-10-21 09:49:28 -03:00
|
|
|
fixed.append(path)
|
|
|
|
return fixed
|
|
|
|
|
|
|
|
|
|
|
|
ws_re = re.compile(br'\s+(\r?\n)$')
|
|
|
|
|
|
|
|
@status("Fixing docs whitespace", info=report_modified_files)
|
|
|
|
def normalize_docs_whitespace(file_paths):
|
|
|
|
fixed = []
|
|
|
|
for path in file_paths:
|
2011-07-30 16:34:04 -03:00
|
|
|
abspath = os.path.join(SRCDIR, path)
|
2010-10-21 09:49:28 -03:00
|
|
|
try:
|
2011-07-30 16:34:04 -03:00
|
|
|
with open(abspath, 'rb') as f:
|
2010-10-21 09:49:28 -03:00
|
|
|
lines = f.readlines()
|
|
|
|
new_lines = [ws_re.sub(br'\1', line) for line in lines]
|
|
|
|
if new_lines != lines:
|
2011-07-30 16:34:04 -03:00
|
|
|
shutil.copyfile(abspath, abspath + '.bak')
|
|
|
|
with open(abspath, 'wb') as f:
|
2010-10-21 09:49:28 -03:00
|
|
|
f.writelines(new_lines)
|
|
|
|
fixed.append(path)
|
|
|
|
except Exception as err:
|
|
|
|
print('Cannot fix %s: %s' % (path, err))
|
|
|
|
return fixed
|
|
|
|
|
|
|
|
|
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
|
|
|
@status("Docs modified", modal=True)
|
|
|
|
def docs_modified(file_paths):
|
2010-07-04 19:05:34 -03:00
|
|
|
"""Report if any file in the Doc directory has been changed."""
|
|
|
|
return bool(file_paths)
|
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
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
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
|
|
|
@status("Misc/ACKS updated", modal=True)
|
|
|
|
def credit_given(file_paths):
|
|
|
|
"""Check if Misc/ACKS has been changed."""
|
2013-07-21 21:57:44 -03:00
|
|
|
return os.path.join('Misc', 'ACKS') in file_paths
|
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
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
2017-06-24 22:21:49 -03:00
|
|
|
@status("Misc/NEWS.d updated with `blurb`", modal=True)
|
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
|
|
|
def reported_news(file_paths):
|
2017-06-24 22:21:49 -03:00
|
|
|
"""Check if Misc/NEWS.d has been changed."""
|
|
|
|
return any(p.startswith(os.path.join('Misc', 'NEWS.d', 'next'))
|
|
|
|
for p in file_paths)
|
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
|
|
|
|
2012-03-11 14:21:07 -03:00
|
|
|
@status("configure regenerated", modal=True, info=str)
|
|
|
|
def regenerated_configure(file_paths):
|
|
|
|
"""Check if configure has been regenerated."""
|
2012-03-14 19:17:31 -03:00
|
|
|
if 'configure.ac' in file_paths:
|
2012-03-11 14:21:07 -03:00
|
|
|
return "yes" if 'configure' in file_paths else "no"
|
|
|
|
else:
|
|
|
|
return "not needed"
|
|
|
|
|
|
|
|
@status("pyconfig.h.in regenerated", modal=True, info=str)
|
|
|
|
def regenerated_pyconfig_h_in(file_paths):
|
|
|
|
"""Check if pyconfig.h.in has been regenerated."""
|
2012-03-14 19:17:31 -03:00
|
|
|
if 'configure.ac' in file_paths:
|
2012-03-11 14:21:07 -03:00
|
|
|
return "yes" if 'pyconfig.h.in' in file_paths else "no"
|
|
|
|
else:
|
|
|
|
return "not needed"
|
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
|
|
|
|
2021-12-30 20:16:27 -04:00
|
|
|
def ci(pull_request):
|
2017-06-24 20:51:23 -03:00
|
|
|
if pull_request == 'false':
|
|
|
|
print('Not a pull request; skipping')
|
|
|
|
return
|
|
|
|
base_branch = get_base_branch()
|
|
|
|
file_paths = changed_files(base_branch)
|
|
|
|
python_files = [fn for fn in file_paths if fn.endswith('.py')]
|
|
|
|
c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))]
|
|
|
|
doc_files = [fn for fn in file_paths if fn.startswith('Doc') and
|
|
|
|
fn.endswith(('.rst', '.inc'))]
|
|
|
|
fixed = []
|
|
|
|
fixed.extend(normalize_whitespace(python_files))
|
|
|
|
fixed.extend(normalize_c_whitespace(c_files))
|
|
|
|
fixed.extend(normalize_docs_whitespace(doc_files))
|
|
|
|
if not fixed:
|
|
|
|
print('No whitespace issues found')
|
|
|
|
else:
|
|
|
|
print(f'Please fix the {len(fixed)} file(s) with whitespace issues')
|
|
|
|
print('(on UNIX you can run `make patchcheck` to make the fixes)')
|
|
|
|
sys.exit(1)
|
|
|
|
|
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
|
|
|
def main():
|
2017-03-11 23:19:08 -04:00
|
|
|
base_branch = get_base_branch()
|
|
|
|
file_paths = changed_files(base_branch)
|
2010-07-04 19:05:34 -03:00
|
|
|
python_files = [fn for fn in file_paths if fn.endswith('.py')]
|
|
|
|
c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))]
|
2014-10-19 06:54:08 -03:00
|
|
|
doc_files = [fn for fn in file_paths if fn.startswith('Doc') and
|
|
|
|
fn.endswith(('.rst', '.inc'))]
|
2017-06-24 22:21:49 -03:00
|
|
|
misc_files = {p for p in file_paths if p.startswith('Misc')}
|
2010-07-04 19:05:34 -03:00
|
|
|
# PEP 8 whitespace rules enforcement.
|
|
|
|
normalize_whitespace(python_files)
|
2010-10-21 09:49:28 -03:00
|
|
|
# C rules enforcement.
|
|
|
|
normalize_c_whitespace(c_files)
|
|
|
|
# Doc whitespace enforcement.
|
|
|
|
normalize_docs_whitespace(doc_files)
|
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
|
|
|
# Docs updated.
|
2010-10-21 09:49:28 -03:00
|
|
|
docs_modified(doc_files)
|
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
|
|
|
# Misc/ACKS changed.
|
2013-07-21 21:57:44 -03:00
|
|
|
credit_given(misc_files)
|
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
|
|
|
# Misc/NEWS changed.
|
2013-07-21 21:57:44 -03:00
|
|
|
reported_news(misc_files)
|
2012-03-11 14:21:07 -03:00
|
|
|
# Regenerated configure, if necessary.
|
|
|
|
regenerated_configure(file_paths)
|
|
|
|
# Regenerated pyconfig.h.in, if necessary.
|
|
|
|
regenerated_pyconfig_h_in(file_paths)
|
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
|
|
|
|
|
|
|
# Test suite run and passed.
|
2011-08-12 12:50:08 -03:00
|
|
|
if python_files or c_files:
|
2013-01-11 08:07:47 -04:00
|
|
|
end = " and check for refleaks?" if c_files else "?"
|
2011-08-12 12:50:08 -03:00
|
|
|
print()
|
2013-01-11 08:07:47 -04:00
|
|
|
print("Did you run the test suite" + end)
|
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
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-06-24 20:51:23 -03:00
|
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
2021-12-30 20:16:27 -04:00
|
|
|
parser.add_argument('--ci',
|
2017-06-24 20:51:23 -03:00
|
|
|
help='Perform pass/fail checks')
|
|
|
|
args = parser.parse_args()
|
2021-12-30 20:16:27 -04:00
|
|
|
if args.ci:
|
|
|
|
ci(args.ci)
|
2017-06-24 20:51:23 -03:00
|
|
|
else:
|
|
|
|
main()
|