Skip to content

Add setup.py #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
51 changes: 23 additions & 28 deletions cherry_picker/readme.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
Usage::
Usage (from a cloned CPython directory) ::

python -m cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] <commit_sha1> <branches>
cherry_picker [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] <commit_sha1> <branches>

Alternate Usage (from an existing cpython directory)::

python <path to cherry_picker.py> [--push REMOTE] [--dry-run] [--status] [--abort/--continue] [--no-push] <commit_sha1> <branches>



.. 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
Expand All @@ -32,14 +27,15 @@ Requires Python 3.6.
::

$ git clone https://github.com/python/core-workflow.git
$ cd core-workflow/cherry_picker
$ python -m venv venv
$ cd core-workflow
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install -r requirements.txt
(venv) $ git clone https://github.com/<username>/cpython.git # your own cpython fork
(venv) $ cd cpython
(venv) $ git remote add upstream https://github.com/python/cpython.git
(venv) $ cd ../
(venv) $ python -m pip install --upgrade .

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
Expand All @@ -56,9 +52,11 @@ Cherry-picking :snake: :cherries: :pick:

(Setup first! See prev section)

From the cloned CPython directory:

::

(venv) $ python -m cherry_picker [--dry-run] [--abort/--continue] [--status] [--no-push] <commit_sha1> <branches>
(venv) $ cherry_picker [--dry-run] [--abort/--continue] [--status] [--no-push] <commit_sha1> <branches>


Commit sha1
Expand Down Expand Up @@ -93,26 +91,25 @@ 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:

::

(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:

::

(venv) $ cd cpython

(venv) $ git fetch upstream

(venv) $ git checkout -b backport-6de2b78-3.5 upstream/3.5
Expand All @@ -133,21 +130,19 @@ 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
$ 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


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
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
35 changes: 35 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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='[email protected]',
Copy link
Contributor

@ncoghlan ncoghlan May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to put [email protected] as your address here, so folks know to contact the list with any questions, rather than contacting you directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added @Mariatta 's mail address. We may want to keep it and add maintainer / maintainer_email for contact. After all Marietta wrote the script and deserves credits. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 😸 Well I've prepared a canned response already "Please file an issue at python/core-workflow"

I'll add the following:

"maintainer": "Python Core Developers",
"maintainer_email": "[email protected]",

Question: is version metadata not needed? The doc seems to indicate that it's required.

maintainer='Python Core Developers',
maintainer_email='[email protected]',
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,
)