From 981cc1a7d5fde58af28ac9d55d86d3780a421d59 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 23 May 2017 17:04:06 -0700 Subject: [PATCH 1/4] Add setup.py ``venv/bin/pip install .`` installs all dependencies and venv/bin/cherry_picker script. Signed-off-by: Christian Heimes --- cherry_picker/readme.rst | 24 +++++++++++------------- setup.cfg | 2 ++ setup.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 setup.cfg create mode 100755 setup.py diff --git a/cherry_picker/readme.rst b/cherry_picker/readme.rst index f7a43ba..c563c97 100644 --- a/cherry_picker/readme.rst +++ b/cherry_picker/readme.rst @@ -2,11 +2,9 @@ Usage:: python -m cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] -Alternate Usage (from an existing cpython directory):: - - python [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] - +Alternate Usage (virtual env installation):: + /path/to/venv/bin/cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] .. contents:: @@ -32,10 +30,10 @@ Requires Python 3.6. :: $ git clone https://github.com/python/core-workflow.git - $ cd core-workflow/cherry_picker + $ cd core-workflow $ python -m venv venv $ source venv/bin/activate - (venv) $ python -m pip install -r requirements.txt + (venv) $ python -m pip install --upgrade . (venv) $ git clone https://github.com//cpython.git # your own cpython fork (venv) $ cd cpython (venv) $ git remote add upstream https://github.com/python/cpython.git @@ -58,7 +56,7 @@ Cherry-picking :snake: :cherries: :pick: :: - (venv) $ python -m cherry_picker [--dry-run] [--abort/--continue] [--status] [--no-push] + (venv) $ cherry_picker [--dry-run] [--abort/--continue] [--status] [--no-push] Commit sha1 @@ -104,7 +102,7 @@ For example, to cherry-pick ``6de2b7817f-some-commit-sha1-d064`` into :: - (venv) $ python -m cherry_picker 6de2b7817f-some-commit-sha1-d064 3.5 3.6 + (venv) $ cherry_picker 6de2b7817f-some-commit-sha1-d064 3.5 3.6 What this will do: @@ -133,21 +131,21 @@ In case of merge conflicts or errors, the following message will be displayed:: ... Stopping here. To continue and resolve the conflict: - $ python -m cherry_picker --status # to find out which files need attention + $ cherry_picker --status # to find out which files need attention $ cd cpython # Fix the conflict $ cd .. - $ python -m cherry_picker --status # should now say 'all conflict fixed' - $ python -m cherry_picker --continue + $ cherry_picker --status # should now say 'all conflict fixed' + $ cherry_picker --continue To abort the cherry-pick and cleanup: - $ python -m cherry_picker --abort + $ cherry_picker --abort Passing the `--dry-run` option will cause the script to print out all the steps it would execute without actually executing any of them. For example:: - $ python -m cherry_picker --dry-run --push pr 1e32a1be4a1705e34011770026cb64ada2d340b5 3.6 3.5 + $ cherry_picker --dry-run --push pr 1e32a1be4a1705e34011770026cb64ada2d340b5 3.6 3.5 Dry run requested, listing expected command sequence fetching upstream ... dry_run: git fetch origin diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..17b5143 --- /dev/null +++ b/setup.py @@ -0,0 +1,33 @@ +from setuptools import setup + + +with open('cherry_picker/readme.rst') as f: + long_description = f.read() + + +with open('cherry_picker/requirements.txt') as f: + requirements = [l.strip() for l in f.read().split('\n')] + + +setup( + name='cherry_picker', + description='backport cpython changes from master to maintenance branches', + long_description=long_description, + license='Apache', + url='https://github.com/python/core-workflow', + author='Mariatta Wijaya', + author_email='mariatta.wijaya@gmail.com', + packages=[ + 'cherry_picker', + ], + entry_points={ + 'console_scripts': [ + 'cherry_picker = cherry_picker.cherry_picker:cherry_pick_cli', + ], + }, + classifiers=[ + 'Programming Language :: Python :: 3.6', + 'Intended Audience :: Developers', + ], + install_requires=requirements, +) From 5e8be410e4db9366622e42620f836a3b50a4022e Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Tue, 30 May 2017 21:12:44 -0700 Subject: [PATCH 2/4] Update readme and asciinema url --- cherry_picker/cherry_picker.py | 14 ++++++-------- cherry_picker/readme.rst | 29 +++++++++++++---------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/cherry_picker/cherry_picker.py b/cherry_picker/cherry_picker.py index 29c160a..7ad1c68 100755 --- a/cherry_picker/cherry_picker.py +++ b/cherry_picker/cherry_picker.py @@ -113,15 +113,13 @@ def get_exit_message(self, branch): ... Stopping here. To continue and resolve the conflict: - $ python -m cherry_picker --status # to find out which files need attention - $ cd cpython + $ cherry_picker --status # to find out which files need attention # Fix the conflict - $ cd .. - $ python -m cherry_picker --status # should now say 'all conflict fixed' - $ python -m cherry_picker --continue + $ cherry_picker --status # should now say 'all conflict fixed' + $ cherry_picker --continue To abort the cherry-pick and cleanup: - $ python -m cherry_picker --abort + $ cherry_picker --abort """ def amend_commit_message(self, cherry_pick_branch): @@ -203,10 +201,10 @@ def backport(self): --no-push option used. ... Stopping here. To continue and push the changes: - $ python -m cherry_picker --continue + $ cherry_picker --continue To abort the cherry-pick and cleanup: - $ python -m cherry_picker --abort + $ cherry_picker --abort """) def abort_cherry_pick(self): diff --git a/cherry_picker/readme.rst b/cherry_picker/readme.rst index c563c97..62c48bf 100644 --- a/cherry_picker/readme.rst +++ b/cherry_picker/readme.rst @@ -1,17 +1,14 @@ Usage:: - python -m cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] + cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] -Alternate Usage (virtual env installation):: - - /path/to/venv/bin/cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] .. contents:: About ===== -Use this to backport cpython changes from ``master`` into one or more of the +Use this to backport CPython changes from ``master`` into one or more of the maintenance branches (``3.6``, ``3.5``, ``2.7``). It will prefix the commit message with the branch, e.g. ``[3.6]``, and then @@ -31,13 +28,14 @@ Requires Python 3.6. $ git clone https://github.com/python/core-workflow.git $ cd core-workflow - $ python -m venv venv + $ python3 -m venv venv $ source venv/bin/activate (venv) $ python -m pip install --upgrade . - (venv) $ git clone https://github.com//cpython.git # your own cpython fork - (venv) $ cd cpython - (venv) $ git remote add upstream https://github.com/python/cpython.git - (venv) $ cd ../ + +Specify an `upstream` remote in the cloned CPython repository:: + + $ git remote add upstream https://github.com/python/cpython.git + The cherry picking script assumes that if an `upstream` remote is defined, then it should be used as the source of upstream changes and as the base for @@ -54,6 +52,8 @@ Cherry-picking :snake: :cherries: :pick: (Setup first! See prev section) +From the cloned CPython directory: + :: (venv) $ cherry_picker [--dry-run] [--abort/--continue] [--status] [--no-push] @@ -91,14 +91,15 @@ Additional options:: Demo ---- -https://asciinema.org/a/dtayqmjvd5hy5389oubkdk323 +https://asciinema.org/a/122815 Example ------- For example, to cherry-pick ``6de2b7817f-some-commit-sha1-d064`` into -``3.5`` and ``3.6``: +``3.5`` and ``3.6``, run the following command from the cloned CPython +directory: :: @@ -109,8 +110,6 @@ What this will do: :: - (venv) $ cd cpython - (venv) $ git fetch upstream (venv) $ git checkout -b backport-6de2b78-3.5 upstream/3.5 @@ -132,9 +131,7 @@ In case of merge conflicts or errors, the following message will be displayed:: To continue and resolve the conflict: $ cherry_picker --status # to find out which files need attention - $ cd cpython # Fix the conflict - $ cd .. $ cherry_picker --status # should now say 'all conflict fixed' $ cherry_picker --continue From 3387a1ee098dd43b340583420ae7184c82344b32 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Tue, 30 May 2017 21:38:55 -0700 Subject: [PATCH 3/4] clarify that cherry_picker is to be run from cpython dir --- cherry_picker/readme.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cherry_picker/readme.rst b/cherry_picker/readme.rst index 62c48bf..806d160 100644 --- a/cherry_picker/readme.rst +++ b/cherry_picker/readme.rst @@ -1,4 +1,4 @@ -Usage:: +Usage (from a cloned CPython directory) :: cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] From fcd4ac63b22f71244e256829ec832eaa47f28d48 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 31 May 2017 11:13:04 -0700 Subject: [PATCH 4/4] Add maintainer and maintainer_email to setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 17b5143..99a348b 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,8 @@ url='https://github.com/python/core-workflow', author='Mariatta Wijaya', author_email='mariatta.wijaya@gmail.com', + maintainer='Python Core Developers', + maintainer_email='core-workflow@mail.python.org', packages=[ 'cherry_picker', ],