Browse Source

Add a pbr compatible setup

Add a setup.cfg and setup.py and fill in those files
so that gertty can be installed easily.

Adjust gertty.py to have a main function that
can be referenced as a console entrypoint during
installation.

Also adjusted a bunch of imports that were failing after
installation occurred (but now they should not fail since they
correctly reference the gertty module namespace).

Change-Id: I532ced51583b26300ba9a2efb97f8e41bc69ec8d
changes/67/91967/3
Joshua Harlow 8 years ago
parent
commit
7a71108c60
  1. 21
      gertty/app.py
  2. 10
      gertty/view/change.py
  3. 6
      gertty/view/change_list.py
  4. 2
      gertty/view/diff.py
  5. 8
      gertty/view/project_list.py
  6. 1
      requirements.txt
  7. 32
      setup.cfg
  8. 20
      setup.py

21
gertty/gertty.py → gertty/app.py

@ -20,12 +20,12 @@ import threading
import urwid
import db
import config
import gitrepo
import mywid
import sync
import view.project_list
from gertty import db
from gertty import config
from gertty import gitrepo
from gertty import mywid
from gertty import sync
from gertty.view import project_list as view_project_list
palette=[('reversed', 'default,standout', ''),
('header', 'white,bold', 'dark blue'),
@ -130,7 +130,7 @@ class App(object):
self.screens = []
self.status = StatusHeader(self)
self.header = urwid.AttrMap(self.status, 'header')
screen = view.project_list.ProjectListView(self)
screen = view_project_list.ProjectListView(self)
self.status.update(title=screen.title)
self.loop = urwid.MainLoop(screen, palette=palette,
unhandled_input=self.unhandledInput)
@ -221,7 +221,8 @@ class App(object):
return gitrepo.Repo(self.config.url+'p/'+project_name,
local_path)
if __name__ == '__main__':
def main():
parser = argparse.ArgumentParser(
description='Console client for Gerrit Code Review.')
parser.add_argument('-d', dest='debug', action='store_true',
@ -233,3 +234,7 @@ if __name__ == '__main__':
args = parser.parse_args()
g = App(args.server, args.debug, args.no_sync)
g.run()
if __name__ == '__main__':
main()

10
gertty/view/change.py

@ -16,10 +16,10 @@ import datetime
import urwid
import gitrepo
import mywid
import sync
import view.diff
from gertty import gitrepo
from gertty import mywid
from gertty import sync
from gertty.view import diff as view_diff
class ReviewDialog(urwid.WidgetWrap):
signals = ['save', 'cancel']
@ -384,4 +384,4 @@ This Screen
return r
def diff(self, revision_key):
self.app.changeScreen(view.diff.DiffView(self.app, revision_key))
self.app.changeScreen(view_diff.DiffView(self.app, revision_key))

6
gertty/view/change_list.py

@ -14,8 +14,8 @@
import urwid
import mywid
import view.change
from gertty import mywid
from gertty.view import change as view_change
class ChangeRow(urwid.Button):
change_focus_map = {None: 'reversed',
@ -139,4 +139,4 @@ This Screen
return super(ChangeListView, self).keypress(size, key)
def onSelect(self, button, change_key):
self.app.changeScreen(view.change.ChangeView(self.app, change_key))
self.app.changeScreen(view_change.ChangeView(self.app, change_key))

2
gertty/view/diff.py

@ -17,7 +17,7 @@ import logging
import urwid
import mywid
from gertty import mywid
class LineContext(object):
def __init__(self, old_revision_key, new_revision_key,

8
gertty/view/project_list.py

@ -14,9 +14,9 @@
import urwid
import mywid
import sync
import view.change_list
from gertty import mywid
from gertty import sync
from gertty.view import change_list as view_change_list
class ProjectRow(urwid.Button):
project_focus_map = {None: 'reversed',
@ -113,7 +113,7 @@ This Screen
return ret
def onSelect(self, button, project_key):
self.app.changeScreen(view.change_list.ChangeListView(self.app, project_key))
self.app.changeScreen(view_change_list.ChangeListView(self.app, project_key))
def keypress(self, size, key):
if key=='l':

1
requirements.txt

@ -4,3 +4,4 @@ GitPython>=0.3.2.RC1
python-dateutil
requests
ordereddict
pbr>=0.6,!=0.7,<1.0

32
setup.cfg

@ -0,0 +1,32 @@
[metadata]
name = gertty
summary = Gertty is a console-based interface to the Gerrit Code Review system.
description-file =
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
classifier =
Topic :: Utilities
Intended Audience :: Developers
Intended Audience :: Information Technology
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
keywords = gerrit console urwid review
[global]
setup-hooks =
pbr.hooks.setup_hook
[files]
packages =
gertty
[entry_points]
console_scripts =
gertty = gertty.app:main

20
setup.py

@ -0,0 +1,20 @@
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
Loading…
Cancel
Save