patch-manager 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {patch-manager-0.0.4 → patch-manager-0.0.6}/PKG-INFO +2 -2
  2. {patch-manager-0.0.4 → patch-manager-0.0.6}/pyproject.toml +3 -3
  3. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patch_manager.egg-info/PKG-INFO +2 -2
  4. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patch_manager.egg-info/SOURCES.txt +5 -1
  5. patch-manager-0.0.6/src/patch_manager.egg-info/entry_points.txt +2 -0
  6. patch-manager-0.0.6/src/patch_manager.egg-info/requires.txt +1 -0
  7. patch-manager-0.0.6/src/patman/__main__.py +98 -0
  8. patch-manager-0.0.6/src/patman/cmdline.py +147 -0
  9. patch-manager-0.0.6/src/patman/func_test.py +1379 -0
  10. patch-manager-0.0.6/src/patman/test_checkpatch.py +533 -0
  11. patch-manager-0.0.6/src/patman/test_settings.py +67 -0
  12. patch-manager-0.0.4/src/patch_manager.egg-info/entry_points.txt +0 -2
  13. patch-manager-0.0.4/src/patch_manager.egg-info/requires.txt +0 -1
  14. patch-manager-0.0.4/src/patman/__main__.py +0 -202
  15. {patch-manager-0.0.4 → patch-manager-0.0.6}/LICENSE +0 -0
  16. {patch-manager-0.0.4 → patch-manager-0.0.6}/README.rst +0 -0
  17. {patch-manager-0.0.4 → patch-manager-0.0.6}/setup.cfg +0 -0
  18. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patch_manager.egg-info/dependency_links.txt +0 -0
  19. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patch_manager.egg-info/top_level.txt +0 -0
  20. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/README.rst +0 -0
  21. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/__init__.py +0 -0
  22. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/checkpatch.py +0 -0
  23. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/commit.py +0 -0
  24. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/control.py +0 -0
  25. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/get_maintainer.py +0 -0
  26. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/gitutil.py +0 -0
  27. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/patchstream.py +0 -0
  28. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/patman.rst +0 -0
  29. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/project.py +0 -0
  30. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/series.py +0 -0
  31. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/settings.py +0 -0
  32. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/setup.py +0 -0
  33. {patch-manager-0.0.4 → patch-manager-0.0.6}/src/patman/status.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: patch-manager
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Patman patch manager
5
5
  Author-email: Simon Glass <sjg@chromium.org>
6
6
  Project-URL: Homepage, https://docs.u-boot.org/en/latest/develop/patman.html
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/x-rst
13
13
  License-File: LICENSE
14
- Requires-Dist: u_boot_pylib>=0.0.4
14
+ Requires-Dist: u_boot_pylib>=0.0.6
15
15
 
16
16
  .. SPDX-License-Identifier: GPL-2.0+
17
17
  .. Copyright (c) 2011 The Chromium OS Authors
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "patch-manager"
7
- version = "0.0.4"
7
+ version = "0.0.6"
8
8
  authors = [
9
9
  { name="Simon Glass", email="sjg@chromium.org" },
10
10
  ]
11
- dependencies = ["u_boot_pylib >= 0.0.4"]
11
+ dependencies = ["u_boot_pylib >= 0.0.6"]
12
12
  description = "Patman patch manager"
13
13
  readme = "README.rst"
14
14
  requires-python = ">=3.7"
@@ -23,7 +23,7 @@ classifiers = [
23
23
  "Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues"
24
24
 
25
25
  [project.scripts]
26
- patman = "patman.__main__"
26
+ patman = "patman.__main__:run_patman"
27
27
 
28
28
  [tool.setuptools.package-data]
29
29
  patman = ["*.rst"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: patch-manager
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Patman patch manager
5
5
  Author-email: Simon Glass <sjg@chromium.org>
6
6
  Project-URL: Homepage, https://docs.u-boot.org/en/latest/develop/patman.html
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.7
12
12
  Description-Content-Type: text/x-rst
13
13
  License-File: LICENSE
14
- Requires-Dist: u_boot_pylib>=0.0.4
14
+ Requires-Dist: u_boot_pylib>=0.0.6
15
15
 
16
16
  .. SPDX-License-Identifier: GPL-2.0+
17
17
  .. Copyright (c) 2011 The Chromium OS Authors
@@ -11,8 +11,10 @@ src/patman/README.rst
11
11
  src/patman/__init__.py
12
12
  src/patman/__main__.py
13
13
  src/patman/checkpatch.py
14
+ src/patman/cmdline.py
14
15
  src/patman/commit.py
15
16
  src/patman/control.py
17
+ src/patman/func_test.py
16
18
  src/patman/get_maintainer.py
17
19
  src/patman/gitutil.py
18
20
  src/patman/patchstream.py
@@ -21,4 +23,6 @@ src/patman/project.py
21
23
  src/patman/series.py
22
24
  src/patman/settings.py
23
25
  src/patman/setup.py
24
- src/patman/status.py
26
+ src/patman/status.py
27
+ src/patman/test_checkpatch.py
28
+ src/patman/test_settings.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ patman = patman.__main__:run_patman
@@ -0,0 +1 @@
1
+ u_boot_pylib>=0.0.6
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env python3
2
+ # SPDX-License-Identifier: GPL-2.0+
3
+ #
4
+ # Copyright (c) 2011 The Chromium OS Authors.
5
+ #
6
+
7
+ """See README for more information"""
8
+
9
+ try:
10
+ from importlib import resources
11
+ except ImportError:
12
+ # for Python 3.6
13
+ import importlib_resources as resources
14
+ import os
15
+ import re
16
+ import sys
17
+ import traceback
18
+
19
+ # Allow 'from patman import xxx to work'
20
+ # pylint: disable=C0413
21
+ our_path = os.path.dirname(os.path.realpath(__file__))
22
+ sys.path.append(os.path.join(our_path, '..'))
23
+
24
+ # Our modules
25
+ from patman import cmdline
26
+ from patman import control
27
+ from u_boot_pylib import terminal
28
+ from u_boot_pylib import test_util
29
+ from u_boot_pylib import tools
30
+
31
+
32
+ def run_patman():
33
+ """Run patamn
34
+
35
+ This is the main program. It collects arguments and runs either the tests or
36
+ the control module.
37
+ """
38
+ args = cmdline.parse_args()
39
+
40
+ if not args.debug:
41
+ sys.tracebacklimit = 0
42
+
43
+ # Run our meagre tests
44
+ if args.cmd == 'test':
45
+ # pylint: disable=C0415
46
+ from patman import func_test
47
+ from patman import test_checkpatch
48
+
49
+ result = test_util.run_test_suites(
50
+ 'patman', False, False, False, None, None, None,
51
+ [test_checkpatch.TestPatch, func_test.TestFunctional,
52
+ 'gitutil', 'settings'])
53
+
54
+ sys.exit(0 if result.wasSuccessful() else 1)
55
+
56
+ # Process commits, produce patches files, check them, email them
57
+ elif args.cmd == 'send':
58
+ # Called from git with a patch filename as argument
59
+ # Printout a list of additional CC recipients for this patch
60
+ if args.cc_cmd:
61
+ re_line = re.compile(r'(\S*) (.*)')
62
+ with open(args.cc_cmd, 'r', encoding='utf-8') as inf:
63
+ for line in inf.readlines():
64
+ match = re_line.match(line)
65
+ if match and match.group(1) == args.patchfiles[0]:
66
+ for cca in match.group(2).split('\0'):
67
+ cca = cca.strip()
68
+ if cca:
69
+ print(cca)
70
+
71
+ elif args.full_help:
72
+ with resources.path('patman', 'README.rst') as readme:
73
+ tools.print_full_help(str(readme))
74
+ else:
75
+ # If we are not processing tags, no need to warning about bad ones
76
+ if not args.process_tags:
77
+ args.ignore_bad_tags = True
78
+ control.send(args)
79
+
80
+ # Check status of patches in patchwork
81
+ elif args.cmd == 'status':
82
+ ret_code = 0
83
+ try:
84
+ control.patchwork_status(args.branch, args.count, args.start, args.end,
85
+ args.dest_branch, args.force,
86
+ args.show_comments, args.patchwork_url)
87
+ except Exception as exc:
88
+ terminal.tprint(f'patman: {type(exc).__name__}: {exc}',
89
+ colour=terminal.Color.RED)
90
+ if args.debug:
91
+ print()
92
+ traceback.print_exc()
93
+ ret_code = 1
94
+ sys.exit(ret_code)
95
+
96
+
97
+ if __name__ == "__main__":
98
+ sys.exit(run_patman())
@@ -0,0 +1,147 @@
1
+ # SPDX-License-Identifier: GPL-2.0+
2
+ #
3
+ # Copyright 2023 Google LLC
4
+ #
5
+
6
+ """Handles parsing of buildman arguments
7
+
8
+ This creates the argument parser and uses it to parse the arguments passed in
9
+ """
10
+
11
+ import argparse
12
+ import os
13
+ import pathlib
14
+ import sys
15
+
16
+ from patman import gitutil
17
+ from patman import project
18
+ from patman import settings
19
+
20
+ PATMAN_DIR = pathlib.Path(__file__).parent
21
+ HAS_TESTS = os.path.exists(PATMAN_DIR / "func_test.py")
22
+
23
+ def parse_args():
24
+ """Parse command line arguments from sys.argv[]
25
+
26
+ Returns:
27
+ tuple containing:
28
+ options: command line options
29
+ args: command lin arguments
30
+ """
31
+ epilog = '''Create patches from commits in a branch, check them and email
32
+ them as specified by tags you place in the commits. Use -n to do a dry
33
+ run first.'''
34
+
35
+ parser = argparse.ArgumentParser(epilog=epilog)
36
+ parser.add_argument('-b', '--branch', type=str,
37
+ help="Branch to process (by default, the current branch)")
38
+ parser.add_argument('-c', '--count', dest='count', type=int,
39
+ default=-1, help='Automatically create patches from top n commits')
40
+ parser.add_argument('-e', '--end', type=int, default=0,
41
+ help='Commits to skip at end of patch list')
42
+ parser.add_argument('-D', '--debug', action='store_true',
43
+ help='Enabling debugging (provides a full traceback on error)')
44
+ parser.add_argument('-p', '--project', default=project.detect_project(),
45
+ help="Project name; affects default option values and "
46
+ "aliases [default: %(default)s]")
47
+ parser.add_argument('-P', '--patchwork-url',
48
+ default='https://patchwork.ozlabs.org',
49
+ help='URL of patchwork server [default: %(default)s]')
50
+ parser.add_argument('-s', '--start', dest='start', type=int,
51
+ default=0, help='Commit to start creating patches from (0 = HEAD)')
52
+ parser.add_argument(
53
+ '-v', '--verbose', action='store_true', dest='verbose', default=False,
54
+ help='Verbose output of errors and warnings')
55
+ parser.add_argument(
56
+ '-H', '--full-help', action='store_true', dest='full_help',
57
+ default=False, help='Display the README file')
58
+
59
+ subparsers = parser.add_subparsers(dest='cmd')
60
+ send = subparsers.add_parser(
61
+ 'send', help='Format, check and email patches (default command)')
62
+ send.add_argument('-i', '--ignore-errors', action='store_true',
63
+ dest='ignore_errors', default=False,
64
+ help='Send patches email even if patch errors are found')
65
+ send.add_argument('-l', '--limit-cc', dest='limit', type=int, default=None,
66
+ help='Limit the cc list to LIMIT entries [default: %(default)s]')
67
+ send.add_argument('-m', '--no-maintainers', action='store_false',
68
+ dest='add_maintainers', default=True,
69
+ help="Don't cc the file maintainers automatically")
70
+ send.add_argument(
71
+ '--get-maintainer-script', dest='get_maintainer_script', type=str,
72
+ action='store',
73
+ default=os.path.join(gitutil.get_top_level(), 'scripts',
74
+ 'get_maintainer.pl') + ' --norolestats',
75
+ help='File name of the get_maintainer.pl (or compatible) script.')
76
+ send.add_argument('-n', '--dry-run', action='store_true', dest='dry_run',
77
+ default=False, help="Do a dry run (create but don't email patches)")
78
+ send.add_argument('-r', '--in-reply-to', type=str, action='store',
79
+ help="Message ID that this series is in reply to")
80
+ send.add_argument('-t', '--ignore-bad-tags', action='store_true',
81
+ default=False,
82
+ help='Ignore bad tags / aliases (default=warn)')
83
+ send.add_argument('-T', '--thread', action='store_true', dest='thread',
84
+ default=False, help='Create patches as a single thread')
85
+ send.add_argument('--cc-cmd', dest='cc_cmd', type=str, action='store',
86
+ default=None, help='Output cc list for patch file (used by git)')
87
+ send.add_argument('--no-binary', action='store_true', dest='ignore_binary',
88
+ default=False,
89
+ help="Do not output contents of changes in binary files")
90
+ send.add_argument('--no-check', action='store_false', dest='check_patch',
91
+ default=True,
92
+ help="Don't check for patch compliance")
93
+ send.add_argument(
94
+ '--tree', dest='check_patch_use_tree', default=False,
95
+ action='store_true',
96
+ help=("Set `tree` to True. If `tree` is False then we'll pass "
97
+ "'--no-tree' to checkpatch (default: tree=%(default)s)"))
98
+ send.add_argument('--no-tree', dest='check_patch_use_tree',
99
+ action='store_false', help="Set `tree` to False")
100
+ send.add_argument(
101
+ '--no-tags', action='store_false', dest='process_tags', default=True,
102
+ help="Don't process subject tags as aliases")
103
+ send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
104
+ default=True, help="Don't add Signed-off-by to patches")
105
+ send.add_argument('--smtp-server', type=str,
106
+ help="Specify the SMTP server to 'git send-email'")
107
+ send.add_argument('--keep-change-id', action='store_true',
108
+ help='Preserve Change-Id tags in patches to send.')
109
+
110
+ send.add_argument('patchfiles', nargs='*')
111
+
112
+ # Only add the 'test' action if the test data files are available.
113
+ if HAS_TESTS:
114
+ test_parser = subparsers.add_parser('test', help='Run tests')
115
+ test_parser.add_argument('testname', type=str, default=None, nargs='?',
116
+ help="Specify the test to run")
117
+
118
+ status = subparsers.add_parser('status',
119
+ help='Check status of patches in patchwork')
120
+ status.add_argument('-C', '--show-comments', action='store_true',
121
+ help='Show comments from each patch')
122
+ status.add_argument(
123
+ '-d', '--dest-branch', type=str,
124
+ help='Name of branch to create with collected responses')
125
+ status.add_argument('-f', '--force', action='store_true',
126
+ help='Force overwriting an existing branch')
127
+
128
+ # Parse options twice: first to get the project and second to handle
129
+ # defaults properly (which depends on project)
130
+ # Use parse_known_args() in case 'cmd' is omitted
131
+ argv = sys.argv[1:]
132
+ args, rest = parser.parse_known_args(argv)
133
+ if hasattr(args, 'project'):
134
+ settings.Setup(parser, args.project)
135
+ args, rest = parser.parse_known_args(argv)
136
+
137
+ # If we have a command, it is safe to parse all arguments
138
+ if args.cmd:
139
+ args = parser.parse_args(argv)
140
+ else:
141
+ # No command, so insert it after the known arguments and before the ones
142
+ # that presumably relate to the 'send' subcommand
143
+ nargs = len(rest)
144
+ argv = argv[:-nargs] + ['send'] + rest
145
+ args = parser.parse_args(argv)
146
+
147
+ return args