
Hi Chris,
On 18 July 2015 at 03:49, Chris Packham judge.packham@gmail.com wrote:
To make it easier to use patman on other projects add a distutils style installer. Now patman can be installed with
cd u-boot/tools/patman && python setup.py install
There are also the usual distutils options for creating source/binary distributions of patman.
This looks good but can you please add a note to the patman README about how to install it?
Tested-by: Simon Glass sjg@chromium.org
Signed-off-by: Chris Packham judge.packham@gmail.com
This gives us something that can be distributed separately as well as in-tree. The import trick allows the python module "patman" to be distributed and enables in-tree use without moving things around. An alternative would be to move the files into a sub directory (unfortunately a directory called "patman" would clash with the existing symlink). I've left this as RFC so that the community can decide if we want to live with this ugliness or come up with something else.
Thanks, Chris
Changes in v2:
- Install as "patman" package
- Allow running in-tree or out-of-tree
tools/patman/__init__.py | 3 +++ tools/patman/patman.py | 20 ++++++++++++-------- tools/patman/setup.py | 13 +++++++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 tools/patman/__init__.py create mode 100644 tools/patman/setup.py
diff --git a/tools/patman/__init__.py b/tools/patman/__init__.py new file mode 100644 index 0000000..7cbe5fa --- /dev/null +++ b/tools/patman/__init__.py @@ -0,0 +1,3 @@ +__all__ = ['checkpatch', 'command', 'commit', 'cros_subprocess',
'get_maintainer', 'gitutil', 'patchstream', 'project',
'series', 'settings', 'terminal', 'test']
diff --git a/tools/patman/patman.py b/tools/patman/patman.py index 6c6473e..e76fc42 100755 --- a/tools/patman/patman.py +++ b/tools/patman/patman.py @@ -14,14 +14,18 @@ import sys import unittest
# Our modules -import checkpatch -import command -import gitutil -import patchstream -import project -import settings -import terminal -import test +try:
- from patman import checkpatch, command, gitutil, patchstream, \
project, settings, terminal, test
+except ImportError:
- import checkpatch
- import command
- import gitutil
- import patchstream
- import project
- import settings
- import terminal
- import test
parser = OptionParser() diff --git a/tools/patman/setup.py b/tools/patman/setup.py new file mode 100644 index 0000000..e61804f --- /dev/null +++ b/tools/patman/setup.py @@ -0,0 +1,13 @@ +# +# SPDX-License-Identifier: GPL-2.0+ +# +from distutils.core import setup +setup(name='patman',
version='1.0',
license='GPL-2.0+',
scripts=['patman'],
packages=['patman'],
package_dir={'patman': ''},
package_data={'patman': ['README']},
classifiers=['Environment :: Console',
'Topic :: Software Development'])
-- 2.5.0.rc0
Regards, Simon