[PATCH 07/15] patman: Rename directory to patmanu

Simon Glass sjg at chromium.org
Sun Feb 19 19:50:03 CET 2023


Hi Sean,

On Sun, 19 Feb 2023 at 09:49, Sean Anderson <seanga2 at gmail.com> wrote:
>
> On 2/19/23 09:51, Simon Glass wrote:
> > The name 'patman' is already taken in PyPi so use 'patmanu' as the name
> > of the package. Rename the source directory accordingly.
>
> Can't we just have a pypi package named e.g. patch-manager while the actual
> package name stays the same?

That's exactly what I tried at first. When I use 'from patman import
xxx' I seem to need patman to be the actual package name. So I ended
up making it the same in the source tree as in the package.

Do you know of a way around that? I would much prefer something like that.

Regards,
Simon


>
> --Sean
>
> > Fix up some uses of this in buildman.
> >
> > Add a symlink to avoid any major disruption for people used to invoking
> > patman from within the source tree.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >   tools/buildman/builder.py                        |  2 +-
> >   tools/buildman/builderthread.py                  |  2 +-
> >   tools/buildman/control.py                        |  4 ++--
> >   tools/buildman/func_test.py                      |  2 +-
> >   tools/buildman/main.py                           |  4 ++--
> >   tools/buildman/test.py                           |  2 +-
> >   tools/patman                                     |  1 +
> >   tools/{patman => patmanu}/.checkpatch.conf       |  0
> >   tools/{patman => patmanu}/.gitignore             |  0
> >   tools/{patman => patmanu}/README.rst             |  0
> >   tools/{patman => patmanu}/__init__.py            |  3 +++
> >   tools/{patman => patmanu}/__main__.py            | 16 ++++++++--------
> >   tools/{patman => patmanu}/checkpatch.py          |  2 +-
> >   tools/{patman => patmanu}/commit.py              |  0
> >   tools/{patman => patmanu}/control.py             |  8 ++++----
> >   tools/{patman => patmanu}/func_test.py           | 16 ++++++++--------
> >   tools/{patman => patmanu}/get_maintainer.py      |  2 +-
> >   tools/{patman => patmanu}/gitutil.py             |  4 ++--
> >   tools/{patman => patmanu}/patchstream.py         |  6 +++---
> >   tools/{patman => patmanu}/patman                 |  0
> >   tools/{patman => patmanu}/patman.rst             |  0
> >   tools/{patman => patmanu}/project.py             |  2 +-
> >   tools/{patman => patmanu}/pytest.ini             |  0
> >   tools/{patman => patmanu}/series.py              |  6 +++---
> >   tools/{patman => patmanu}/settings.py            |  4 ++--
> >   tools/{patman => patmanu}/setup.py               |  0
> >   tools/{patman => patmanu}/status.py              |  4 ++--
> >   .../test/0000-cover-letter.patch                 |  0
> >   .../test/0001-pci-Correct-cast-for-sandbox.patch |  0
> >   ...ast-for-sandbox-in-fdtdec_setup_mem_siz.patch |  0
> >   tools/{patman => patmanu}/test/test01.txt        |  0
> >   tools/{patman => patmanu}/test_checkpatch.py     | 10 +++++-----
> >   tools/{patman => patmanu}/test_settings.py       |  2 +-
> >   33 files changed, 53 insertions(+), 49 deletions(-)
> >   create mode 120000 tools/patman
> >   rename tools/{patman => patmanu}/.checkpatch.conf (100%)
> >   rename tools/{patman => patmanu}/.gitignore (100%)
> >   rename tools/{patman => patmanu}/README.rst (100%)
> >   rename tools/{patman => patmanu}/__init__.py (85%)
> >   rename tools/{patman => patmanu}/__main__.py (96%)
> >   rename tools/{patman => patmanu}/checkpatch.py (99%)
> >   rename tools/{patman => patmanu}/commit.py (100%)
> >   rename tools/{patman => patmanu}/control.py (98%)
> >   rename tools/{patman => patmanu}/func_test.py (99%)
> >   rename tools/{patman => patmanu}/get_maintainer.py (98%)
> >   rename tools/{patman => patmanu}/gitutil.py (99%)
> >   rename tools/{patman => patmanu}/patchstream.py (99%)
> >   rename tools/{patman => patmanu}/patman (100%)
> >   rename tools/{patman => patmanu}/patman.rst (100%)
> >   rename tools/{patman => patmanu}/project.py (95%)
> >   rename tools/{patman => patmanu}/pytest.ini (100%)
> >   rename tools/{patman => patmanu}/series.py (99%)
> >   rename tools/{patman => patmanu}/settings.py (99%)
> >   rename tools/{patman => patmanu}/setup.py (100%)
> >   rename tools/{patman => patmanu}/status.py (99%)
> >   rename tools/{patman => patmanu}/test/0000-cover-letter.patch (100%)
> >   rename tools/{patman => patmanu}/test/0001-pci-Correct-cast-for-sandbox.patch (100%)
> >   rename tools/{patman => patmanu}/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch (100%)
> >   rename tools/{patman => patmanu}/test/test01.txt (100%)
> >   rename tools/{patman => patmanu}/test_checkpatch.py (99%)
> >   rename tools/{patman => patmanu}/test_settings.py (98%)
> >
> > diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
> > index cbfffe191eb..a04eb5f5e42 100644
> > --- a/tools/buildman/builder.py
> > +++ b/tools/buildman/builder.py
> > @@ -19,7 +19,7 @@ import time
> >
> >   from buildman import builderthread
> >   from buildman import toolchain
> > -from patman import gitutil
> > +from patmanu import gitutil
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib.terminal import tprint
> > diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
> > index b8274addb4a..9ef63e61af7 100644
> > --- a/tools/buildman/builderthread.py
> > +++ b/tools/buildman/builderthread.py
> > @@ -10,7 +10,7 @@ import sys
> >   import threading
> >
> >   from buildman import cfgutil
> > -from patman import gitutil
> > +from patmanu import gitutil
> >   from u_boot_pylib import command
> >
> >   RETURN_CODE_RETRY = -1
> > diff --git a/tools/buildman/control.py b/tools/buildman/control.py
> > index 76e4e2709ac..2dc8c6d7f55 100644
> > --- a/tools/buildman/control.py
> > +++ b/tools/buildman/control.py
> > @@ -13,8 +13,8 @@ from buildman import bsettings
> >   from buildman import cfgutil
> >   from buildman import toolchain
> >   from buildman.builder import Builder
> > -from patman import gitutil
> > -from patman import patchstream
> > +from patmanu import gitutil
> > +from patmanu import patchstream
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import tools
> > diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
> > index 3885b9f083b..10dddeef90a 100644
> > --- a/tools/buildman/func_test.py
> > +++ b/tools/buildman/func_test.py
> > @@ -14,7 +14,7 @@ from buildman import bsettings
> >   from buildman import cmdline
> >   from buildman import control
> >   from buildman import toolchain
> > -from patman import gitutil
> > +from patmanu import gitutil
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import test_util
> > diff --git a/tools/buildman/main.py b/tools/buildman/main.py
> > index 6076ba5d63d..4a4945ca5d4 100755
> > --- a/tools/buildman/main.py
> > +++ b/tools/buildman/main.py
> > @@ -23,8 +23,8 @@ from buildman import builder
> >   from buildman import cmdline
> >   from buildman import control
> >   from buildman import toolchain
> > -from patman import patchstream
> > -from patman import gitutil
> > +from patmanu import patchstream
> > +from patmanu import gitutil
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import test_util
> >
> > diff --git a/tools/buildman/test.py b/tools/buildman/test.py
> > index 9fa6445b798..196eb4cabb8 100644
> > --- a/tools/buildman/test.py
> > +++ b/tools/buildman/test.py
> > @@ -16,7 +16,7 @@ from buildman import builder
> >   from buildman import cfgutil
> >   from buildman import control
> >   from buildman import toolchain
> > -from patman import commit
> > +from patmanu import commit
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import test_util
> > diff --git a/tools/patman b/tools/patman
> > new file mode 120000
> > index 00000000000..4081c0abf44
> > --- /dev/null
> > +++ b/tools/patman
> > @@ -0,0 +1 @@
> > +patmanu
> > \ No newline at end of file
> > diff --git a/tools/patman/.checkpatch.conf b/tools/patmanu/.checkpatch.conf
> > similarity index 100%
> > rename from tools/patman/.checkpatch.conf
> > rename to tools/patmanu/.checkpatch.conf
> > diff --git a/tools/patman/.gitignore b/tools/patmanu/.gitignore
> > similarity index 100%
> > rename from tools/patman/.gitignore
> > rename to tools/patmanu/.gitignore
> > diff --git a/tools/patman/README.rst b/tools/patmanu/README.rst
> > similarity index 100%
> > rename from tools/patman/README.rst
> > rename to tools/patmanu/README.rst
> > diff --git a/tools/patman/__init__.py b/tools/patmanu/__init__.py
> > similarity index 85%
> > rename from tools/patman/__init__.py
> > rename to tools/patmanu/__init__.py
> > index 08eeffdf6d2..138b1970ff5 100644
> > --- a/tools/patman/__init__.py
> > +++ b/tools/patmanu/__init__.py
> > @@ -3,3 +3,6 @@
> >   __all__ = ['checkpatch', 'commit', 'control', 'func_test', 'get_maintainer',
> >              'gitutil', '__main__', 'patchstream', 'project', 'series',
> >              'settings','setup', 'status', 'test_checkpatch', 'test_settings']
> > +
> > +def run_patman():
> > +    print("Hello world")
> > diff --git a/tools/patman/__main__.py b/tools/patmanu/__main__.py
> > similarity index 96%
> > rename from tools/patman/__main__.py
> > rename to tools/patmanu/__main__.py
> > index 30632559bb6..4dd332958dc 100755
> > --- a/tools/patman/__main__.py
> > +++ b/tools/patmanu/__main__.py
> > @@ -14,17 +14,17 @@ import sys
> >   import traceback
> >
> >   if __name__ == "__main__":
> > -    # Allow 'from patman import xxx to work'
> > +    # Allow 'from patmanu import xxx to work'
> >       our_path = os.path.dirname(os.path.realpath(__file__))
> >       sys.path.append(os.path.join(our_path, '..'))
> >
> >   # Our modules
> > -from patman import control
> > -from patman import func_test
> > -from patman import gitutil
> > -from patman import project
> > -from patman import settings
> > -from patman import test_checkpatch
> > +from patmanu import control
> > +from patmanu import func_test
> > +from patmanu import gitutil
> > +from patmanu import project
> > +from patmanu import settings
> > +from patmanu import test_checkpatch
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import test_util
> >   from u_boot_pylib import tools
> > @@ -171,7 +171,7 @@ elif args.cmd == 'send':
> >           fd.close()
> >
> >       elif args.full_help:
> > -        with importlib.resources.path('patman', 'README.rst') as readme:
> > +        with importlib.resources.path('patmanu', 'README.rst') as readme:
> >               tools.print_full_help(str(readme))
> >       else:
> >           # If we are not processing tags, no need to warning about bad ones
> > diff --git a/tools/patman/checkpatch.py b/tools/patmanu/checkpatch.py
> > similarity index 99%
> > rename from tools/patman/checkpatch.py
> > rename to tools/patmanu/checkpatch.py
> > index c1dec323f36..55d962f536f 100644
> > --- a/tools/patman/checkpatch.py
> > +++ b/tools/patmanu/checkpatch.py
> > @@ -7,7 +7,7 @@ import os
> >   import re
> >   import sys
> >
> > -from patman import gitutil
> > +from patmanu import gitutil
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >
> > diff --git a/tools/patman/commit.py b/tools/patmanu/commit.py
> > similarity index 100%
> > rename from tools/patman/commit.py
> > rename to tools/patmanu/commit.py
> > diff --git a/tools/patman/control.py b/tools/patmanu/control.py
> > similarity index 98%
> > rename from tools/patman/control.py
> > rename to tools/patmanu/control.py
> > index d1bcea0c9a7..b1e23870d9d 100644
> > --- a/tools/patman/control.py
> > +++ b/tools/patmanu/control.py
> > @@ -11,9 +11,9 @@ the features of patman.
> >   import os
> >   import sys
> >
> > -from patman import checkpatch
> > -from patman import gitutil
> > -from patman import patchstream
> > +from patmanu import checkpatch
> > +from patmanu import gitutil
> > +from patmanu import patchstream
> >   from u_boot_pylib import terminal
> >
> >   def setup():
> > @@ -235,6 +235,6 @@ def patchwork_status(branch, count, start, end, dest_branch, force,
> >
> >       # Import this here to avoid failing on other commands if the dependencies
> >       # are not present
> > -    from patman import status
> > +    from patmanu import status
> >       status.check_patchwork_status(series, found[0], branch, dest_branch, force,
> >                                     show_comments, url)
> > diff --git a/tools/patman/func_test.py b/tools/patmanu/func_test.py
> > similarity index 99%
> > rename from tools/patman/func_test.py
> > rename to tools/patmanu/func_test.py
> > index 8c2dfbe4528..238fd5b6100 100644
> > --- a/tools/patman/func_test.py
> > +++ b/tools/patmanu/func_test.py
> > @@ -16,19 +16,19 @@ import tempfile
> >   import unittest
> >
> >
> > -from patman.commit import Commit
> > -from patman import control
> > -from patman import gitutil
> > -from patman import patchstream
> > -from patman.patchstream import PatchStream
> > -from patman.series import Series
> > -from patman import settings
> > +from patmanu.commit import Commit
> > +from patmanu import control
> > +from patmanu import gitutil
> > +from patmanu import patchstream
> > +from patmanu.patchstream import PatchStream
> > +from patmanu.series import Series
> > +from patmanu import settings
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import tools
> >   from u_boot_pylib.test_util import capture_sys_output
> >
> >   import pygit2
> > -from patman import status
> > +from patmanu import status
> >
> >   PATMAN_DIR = pathlib.Path(__file__).parent
> >   TEST_DATA_DIR = PATMAN_DIR / 'test/'
> > diff --git a/tools/patman/get_maintainer.py b/tools/patmanu/get_maintainer.py
> > similarity index 98%
> > rename from tools/patman/get_maintainer.py
> > rename to tools/patmanu/get_maintainer.py
> > index 8df3d124bac..87581d72d84 100644
> > --- a/tools/patman/get_maintainer.py
> > +++ b/tools/patmanu/get_maintainer.py
> > @@ -7,7 +7,7 @@ import os
> >   import shlex
> >   import shutil
> >
> > -from patman import gitutil
> > +from patmanu import gitutil
> >   from u_boot_pylib import command
> >
> >
> > diff --git a/tools/patman/gitutil.py b/tools/patmanu/gitutil.py
> > similarity index 99%
> > rename from tools/patman/gitutil.py
> > rename to tools/patmanu/gitutil.py
> > index 6700057359f..0afc5574a14 100644
> > --- a/tools/patman/gitutil.py
> > +++ b/tools/patmanu/gitutil.py
> > @@ -5,7 +5,7 @@
> >   import os
> >   import sys
> >
> > -from patman import settings
> > +from patmanu import settings
> >   from u_boot_pylib import command
> >   from u_boot_pylib import terminal
> >
> > @@ -621,7 +621,7 @@ def get_top_level():
> >       This test makes sure that we are running tests in the right subdir
> >
> >       >>> os.path.realpath(os.path.dirname(__file__)) == \
> > -            os.path.join(get_top_level(), 'tools', 'patman')
> > +            os.path.join(get_top_level(), 'tools', 'patmanu')
> >       True
> >       """
> >       return command.output_one_line('git', 'rev-parse', '--show-toplevel')
> > diff --git a/tools/patman/patchstream.py b/tools/patmanu/patchstream.py
> > similarity index 99%
> > rename from tools/patman/patchstream.py
> > rename to tools/patmanu/patchstream.py
> > index f91669a9404..71587aafaf3 100644
> > --- a/tools/patman/patchstream.py
> > +++ b/tools/patmanu/patchstream.py
> > @@ -14,9 +14,9 @@ import queue
> >   import shutil
> >   import tempfile
> >
> > -from patman import commit
> > -from patman import gitutil
> > -from patman.series import Series
> > +from patmanu import commit
> > +from patmanu import gitutil
> > +from patmanu.series import Series
> >   from u_boot_pylib import command
> >
> >   # Tags that we detect and remove
> > diff --git a/tools/patman/patman b/tools/patmanu/patman
> > similarity index 100%
> > rename from tools/patman/patman
> > rename to tools/patmanu/patman
> > diff --git a/tools/patman/patman.rst b/tools/patmanu/patman.rst
> > similarity index 100%
> > rename from tools/patman/patman.rst
> > rename to tools/patmanu/patman.rst
> > diff --git a/tools/patman/project.py b/tools/patmanu/project.py
> > similarity index 95%
> > rename from tools/patman/project.py
> > rename to tools/patmanu/project.py
> > index 4459042b5d4..3e77a3bb385 100644
> > --- a/tools/patman/project.py
> > +++ b/tools/patmanu/project.py
> > @@ -4,7 +4,7 @@
> >
> >   import os.path
> >
> > -from patman import gitutil
> > +from patmanu import gitutil
> >
> >   def detect_project():
> >       """Autodetect the name of the current project.
> > diff --git a/tools/patman/pytest.ini b/tools/patmanu/pytest.ini
> > similarity index 100%
> > rename from tools/patman/pytest.ini
> > rename to tools/patmanu/pytest.ini
> > diff --git a/tools/patman/series.py b/tools/patmanu/series.py
> > similarity index 99%
> > rename from tools/patman/series.py
> > rename to tools/patmanu/series.py
> > index 88417acb434..f2d415609d2 100644
> > --- a/tools/patman/series.py
> > +++ b/tools/patmanu/series.py
> > @@ -8,9 +8,9 @@ import collections
> >   import itertools
> >   import os
> >
> > -from patman import get_maintainer
> > -from patman import gitutil
> > -from patman import settings
> > +from patmanu import get_maintainer
> > +from patmanu import gitutil
> > +from patmanu import settings
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import tools
> >
> > diff --git a/tools/patman/settings.py b/tools/patmanu/settings.py
> > similarity index 99%
> > rename from tools/patman/settings.py
> > rename to tools/patmanu/settings.py
> > index 636983e32da..21552da1387 100644
> > --- a/tools/patman/settings.py
> > +++ b/tools/patmanu/settings.py
> > @@ -12,12 +12,12 @@ import argparse
> >   import os
> >   import re
> >
> > -from patman import gitutil
> > +from patmanu import gitutil
> >
> >   """Default settings per-project.
> >
> >   These are used by _ProjectConfigParser.  Settings names should match
> > -the "dest" of the option parser from patman.py.
> > +the "dest" of the option parser from patmanu.py.
> >   """
> >   _default_settings = {
> >       "u-boot": {},
> > diff --git a/tools/patman/setup.py b/tools/patmanu/setup.py
> > similarity index 100%
> > rename from tools/patman/setup.py
> > rename to tools/patmanu/setup.py
> > diff --git a/tools/patman/status.py b/tools/patmanu/status.py
> > similarity index 99%
> > rename from tools/patman/status.py
> > rename to tools/patmanu/status.py
> > index 5fb436e08ff..f4343ecb939 100644
> > --- a/tools/patman/status.py
> > +++ b/tools/patmanu/status.py
> > @@ -16,8 +16,8 @@ import re
> >   import pygit2
> >   import requests
> >
> > -from patman import patchstream
> > -from patman.patchstream import PatchStream
> > +from patmanu import patchstream
> > +from patmanu.patchstream import PatchStream
> >   from u_boot_pylib import terminal
> >   from u_boot_pylib import tout
> >
> > diff --git a/tools/patman/test/0000-cover-letter.patch b/tools/patmanu/test/0000-cover-letter.patch
> > similarity index 100%
> > rename from tools/patman/test/0000-cover-letter.patch
> > rename to tools/patmanu/test/0000-cover-letter.patch
> > diff --git a/tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch b/tools/patmanu/test/0001-pci-Correct-cast-for-sandbox.patch
> > similarity index 100%
> > rename from tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch
> > rename to tools/patmanu/test/0001-pci-Correct-cast-for-sandbox.patch
> > diff --git a/tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch b/tools/patmanu/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
> > similarity index 100%
> > rename from tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
> > rename to tools/patmanu/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch
> > diff --git a/tools/patman/test/test01.txt b/tools/patmanu/test/test01.txt
> > similarity index 100%
> > rename from tools/patman/test/test01.txt
> > rename to tools/patmanu/test/test01.txt
> > diff --git a/tools/patman/test_checkpatch.py b/tools/patmanu/test_checkpatch.py
> > similarity index 99%
> > rename from tools/patman/test_checkpatch.py
> > rename to tools/patmanu/test_checkpatch.py
> > index a8bb364e42b..da5e7853ace 100644
> > --- a/tools/patman/test_checkpatch.py
> > +++ b/tools/patmanu/test_checkpatch.py
> > @@ -10,11 +10,11 @@ import os
> >   import tempfile
> >   import unittest
> >
> > -from patman import checkpatch
> > -from patman import gitutil
> > -from patman import patchstream
> > -from patman import series
> > -from patman import commit
> > +from patmanu import checkpatch
> > +from patmanu import gitutil
> > +from patmanu import patchstream
> > +from patmanu import series
> > +from patmanu import commit
> >
> >
> >   class Line:
> > diff --git a/tools/patman/test_settings.py b/tools/patmanu/test_settings.py
> > similarity index 98%
> > rename from tools/patman/test_settings.py
> > rename to tools/patmanu/test_settings.py
> > index 06b7cbc3ab6..67efe6d2860 100644
> > --- a/tools/patman/test_settings.py
> > +++ b/tools/patmanu/test_settings.py
> > @@ -9,7 +9,7 @@ import os
> >   import sys
> >   import tempfile
> >
> > -from patman import settings
> > +from patmanu import settings
> >   from u_boot_pylib import tools
> >
> >
>


More information about the U-Boot mailing list