* [PATCH v4 0/6] patman: Support old Python 3 versions
@ 2020-06-07 12:45 Simon Glass
2020-06-07 12:45 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
With the move to supporting only Python 3, patman is reliant on whatever
version of Python 3 is available on the host machine. For old
distributions such as Ubuntu 14.04 this means Python 3.4.0 which seems to
have some problems with importing modules.
This series updates patman to work correctly in this case.
Changes in v4:
- Add a new patch to drop import of test_util in test_util
- Add a cover letter
Changes in v3:
- Split out the gitutil change into a separate patch
- Add more patches based on testing on a dusty Ubuntu 14.04
Changes in v2:
- Update gitutil as well
Simon Glass (6):
patman: Drop unnecessary import in gitutil
patman: Avoid circular dependency between command and tools
patman: Use a dict in gitutil to avoid importing series
patman: Pass in maintainer dirs to avoid and import
patman: Avoid importing gitutil in settings
patman: Drop import of test_util in test_util
tools/patman/command.py | 7 +++----
tools/patman/get_maintainer.py | 14 +++++++-------
tools/patman/gitutil.py | 10 ++++------
tools/patman/main.py | 2 +-
tools/patman/series.py | 3 ++-
tools/patman/settings.py | 7 +++----
tools/patman/test_util.py | 1 -
7 files changed, 20 insertions(+), 24 deletions(-)
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 1/6] patman: Drop unnecessary import in gitutil
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-06-07 12:45 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
The checkpatch module is not used, so drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v3)
Changes in v3:
- Split out the gitutil change into a separate patch
tools/patman/gitutil.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 72fc95d558..c9ceb28a05 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -7,7 +7,6 @@ import os
import subprocess
import sys
-from patman import checkpatch
from patman import command
from patman import series
from patman import settings
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 2/6] patman: Avoid circular dependency between command and tools
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
2020-06-07 12:45 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-06-07 12:45 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
This seems to cause problems in some cases. Split the dependency by
copying the code to command.
Reported-by: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
(no changes since v1)
tools/patman/command.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/patman/command.py b/tools/patman/command.py
index e67ac159e5..bf8ea6c8c3 100644
--- a/tools/patman/command.py
+++ b/tools/patman/command.py
@@ -5,7 +5,6 @@
import os
from patman import cros_subprocess
-from patman import tools
"""Shell command ease-ups for Python."""
@@ -35,9 +34,9 @@ class CommandResult:
def ToOutput(self, binary):
if not binary:
- self.stdout = tools.ToString(self.stdout)
- self.stderr = tools.ToString(self.stderr)
- self.combined = tools.ToString(self.combined)
+ self.stdout = self.stdout.decode('utf-8')
+ self.stderr = self.stderr.decode('utf-8')
+ self.combined = self.combined.decode('utf-8')
return self
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
2020-06-07 12:45 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
2020-06-07 12:45 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-06-07 12:45 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
Only a few members of this class are used and only in a test. To avoid
importing the module, convert the test to use a dict.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v1)
tools/patman/gitutil.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index c9ceb28a05..5189840eab 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -8,7 +8,6 @@ import subprocess
import sys
from patman import command
-from patman import series
from patman import settings
from patman import terminal
from patman import tools
@@ -368,9 +367,9 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
>>> alias['boys'] = ['fred', ' john']
>>> alias['all'] = ['fred ', 'john', ' mary ']
>>> alias[os.getenv('USER')] = ['this-is-me at me.com']
- >>> series = series.Series()
- >>> series.to = ['fred']
- >>> series.cc = ['mary']
+ >>> series = {}
+ >>> series['to'] = ['fred']
+ >>> series['cc'] = ['mary']
>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \
False, alias)
'git send-email --annotate --to "f.bloggs at napier.co.nz" --cc \
@@ -379,7 +378,7 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
alias)
'git send-email --annotate --to "f.bloggs at napier.co.nz" --cc \
"m.poppins at cloud.net" --cc-cmd "./patman --cc-cmd cc-fname" p1'
- >>> series.cc = ['all']
+ >>> series['cc'] = ['all']
>>> EmailPatches(series, 'cover', ['p1', 'p2'], True, True, 'cc-fname', \
True, alias)
'git send-email --annotate --to "this-is-me at me.com" --cc-cmd "./patman \
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (2 preceding siblings ...)
2020-06-07 12:45 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-06-07 12:45 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
Adjust the get_maintainer module to accept a list of directories to search
for the script. This avoids needing to import gitutil.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v1)
tools/patman/get_maintainer.py | 14 +++++++-------
tools/patman/series.py | 3 ++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
index 473f0feebf..af4ba15bcd 100644
--- a/tools/patman/get_maintainer.py
+++ b/tools/patman/get_maintainer.py
@@ -5,17 +5,16 @@
import os
from patman import command
-from patman import gitutil
-def FindGetMaintainer():
+def FindGetMaintainer(try_list):
"""Look for the get_maintainer.pl script.
+ Args:
+ try_list: List of directories to try for the get_maintainer.pl script
+
Returns:
If the script is found we'll return a path to it; else None.
"""
- try_list = [
- os.path.join(gitutil.GetTopLevel(), 'scripts'),
- ]
# Look in the list
for path in try_list:
fname = os.path.join(path, 'get_maintainer.pl')
@@ -24,7 +23,7 @@ def FindGetMaintainer():
return None
-def GetMaintainer(fname, verbose=False):
+def GetMaintainer(dir_list, fname, verbose=False):
"""Run get_maintainer.pl on a file if we find it.
We look for get_maintainer.pl in the 'scripts' directory at the top of
@@ -32,12 +31,13 @@ def GetMaintainer(fname, verbose=False):
then we fail silently.
Args:
+ dir_list: List of directories to try for the get_maintainer.pl script
fname: Path to the patch file to run get_maintainer.pl on.
Returns:
A list of email addresses to CC to.
"""
- get_maintainer = FindGetMaintainer()
+ get_maintainer = FindGetMaintainer(dir_list)
if not get_maintainer:
if verbose:
print("WARNING: Couldn't find get_maintainer.pl")
diff --git a/tools/patman/series.py b/tools/patman/series.py
index ca7ca556dc..b7eef37d03 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -263,7 +263,8 @@ class Series(dict):
if type(add_maintainers) == type(cc):
cc += add_maintainers
elif add_maintainers:
- cc += get_maintainer.GetMaintainer(commit.patch)
+ dir_list = [os.path.join(gitutil.GetTopLevel(), 'scripts')]
+ cc += get_maintainer.GetMaintainer(dir_list, commit.patch)
for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
cc = set(cc) - set(settings.bounces)
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 5/6] patman: Avoid importing gitutil in settings
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (3 preceding siblings ...)
2020-06-07 12:45 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-06-07 12:45 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
Pass this module in so that settings does not need to import it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v3)
Changes in v3:
- Add more patches based on testing on a dusty Ubuntu 14.04
Changes in v2:
- Update gitutil as well
tools/patman/main.py | 2 +-
tools/patman/settings.py | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/patman/main.py b/tools/patman/main.py
index 0974c84059..0df2aa5a98 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -80,7 +80,7 @@ specified by tags you place in the commits. Use -n to do a dry run first."""
# Parse options twice: first to get the project and second to handle
# defaults properly (which depends on project).
(options, args) = parser.parse_args()
-settings.Setup(parser, options.project, '')
+settings.Setup(gitutil, parser, options.project, '')
(options, args) = parser.parse_args()
if __name__ != "__main__":
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index ca74fc611f..635561ac05 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -11,7 +11,6 @@ import os
import re
from patman import command
-from patman import gitutil
from patman import tools
"""Default settings per-project.
@@ -185,7 +184,7 @@ def ReadGitAliases(fname):
fd.close()
-def CreatePatmanConfigFile(config_fname):
+def CreatePatmanConfigFile(gitutil, config_fname):
"""Creates a config file under $(HOME)/.patman if it can't find one.
Args:
@@ -301,7 +300,7 @@ def GetItems(config, section):
except:
raise
-def Setup(parser, project_name, config_fname=''):
+def Setup(gitutil, parser, project_name, config_fname=''):
"""Set up the settings module by reading config files.
Args:
@@ -318,7 +317,7 @@ def Setup(parser, project_name, config_fname=''):
if not os.path.exists(config_fname):
print("No config file found ~/.patman\nCreating one...\n")
- CreatePatmanConfigFile(config_fname)
+ CreatePatmanConfigFile(gitutil, config_fname)
config.read(config_fname)
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 6/6] patman: Drop import of test_util in test_util
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (4 preceding siblings ...)
2020-06-07 12:45 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
@ 2020-06-07 12:45 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-06-07 12:45 UTC (permalink / raw)
To: u-boot
This module doesn't need to import itself. It causes problems on
very old Python 3 (e.g. 3.4.0). Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v4:
- Add a new patch to drop import of test_util in test_util
- Add a cover letter
tools/patman/test_util.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 4d28d9fc92..aac58fb72f 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -11,7 +11,6 @@ import sys
import unittest
from patman import command
-from patman import test_util
from io import StringIO
--
2.27.0.278.ge193c7cf3a9-goog
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v4 5/6] patman: Avoid importing gitutil in settings
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (5 preceding siblings ...)
2020-06-07 12:45 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
Pass this module in so that settings does not need to import it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v3)
Changes in v3:
- Add more patches based on testing on a dusty Ubuntu 14.04
Changes in v2:
- Update gitutil as well
tools/patman/main.py | 2 +-
tools/patman/settings.py | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 6/6] patman: Drop import of test_util in test_util
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (6 preceding siblings ...)
2020-07-06 1:37 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
This module doesn't need to import itself. It causes problems on
very old Python 3 (e.g. 3.4.0). Drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v4:
- Add a new patch to drop import of test_util in test_util
- Add a cover letter
tools/patman/test_util.py | 1 -
1 file changed, 1 deletion(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (7 preceding siblings ...)
2020-07-06 1:37 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
Adjust the get_maintainer module to accept a list of directories to search
for the script. This avoids needing to import gitutil.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v1)
tools/patman/get_maintainer.py | 14 +++++++-------
tools/patman/series.py | 3 ++-
2 files changed, 9 insertions(+), 8 deletions(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (9 preceding siblings ...)
2020-07-06 1:37 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
Only a few members of this class are used and only in a test. To avoid
importing the module, convert the test to use a dict.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v1)
tools/patman/gitutil.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 2/6] patman: Avoid circular dependency between command and tools
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (8 preceding siblings ...)
2020-07-06 1:37 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
2020-07-06 1:37 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
2020-07-06 1:37 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
This seems to cause problems in some cases. Split the dependency by
copying the code to command.
Reported-by: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
(no changes since v1)
tools/patman/command.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 1/6] patman: Drop unnecessary import in gitutil
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
` (10 preceding siblings ...)
2020-07-06 1:37 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
@ 2020-07-06 1:37 ` Simon Glass
11 siblings, 0 replies; 13+ messages in thread
From: Simon Glass @ 2020-07-06 1:37 UTC (permalink / raw)
To: u-boot
The checkpatch module is not used, so drop it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Stefan Bosch <stefan_b@posteo.net>
---
(no changes since v3)
Changes in v3:
- Split out the gitutil change into a separate patch
tools/patman/gitutil.py | 1 -
1 file changed, 1 deletion(-)
Applied to u-boot-dm/next, thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-07-06 1:37 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07 12:45 [PATCH v4 0/6] patman: Support old Python 3 versions Simon Glass
2020-06-07 12:45 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
2020-06-07 12:45 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
2020-06-07 12:45 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
2020-06-07 12:45 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
2020-06-07 12:45 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
2020-06-07 12:45 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
2020-07-06 1:37 ` [PATCH v4 5/6] patman: Avoid importing gitutil in settings Simon Glass
2020-07-06 1:37 ` [PATCH v4 6/6] patman: Drop import of test_util in test_util Simon Glass
2020-07-06 1:37 ` [PATCH v4 4/6] patman: Pass in maintainer dirs to avoid and import Simon Glass
2020-07-06 1:37 ` [PATCH v4 2/6] patman: Avoid circular dependency between command and tools Simon Glass
2020-07-06 1:37 ` [PATCH v4 3/6] patman: Use a dict in gitutil to avoid importing series Simon Glass
2020-07-06 1:37 ` [PATCH v4 1/6] patman: Drop unnecessary import in gitutil Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.