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/91/391991/1
Joshua Harlow 5 years ago
parent
commit
7a71108c60
8 changed files with 79 additions and 21 deletions
  1. 13
    8
      gertty/app.py
  2. 5
    5
      gertty/view/change.py
  3. 3
    3
      gertty/view/change_list.py
  4. 1
    1
      gertty/view/diff.py
  5. 4
    4
      gertty/view/project_list.py
  6. 1
    0
      requirements.txt
  7. 32
    0
      setup.cfg
  8. 20
    0
      setup.py

gertty/gertty.py → gertty/app.py View File

@@ -20,12 +20,12 @@ import threading
20 20
 
21 21
 import urwid
22 22
 
23
-import db
24
-import config
25
-import gitrepo
26
-import mywid
27
-import sync
28
-import view.project_list
23
+from gertty import db
24
+from gertty import config
25
+from gertty import gitrepo
26
+from gertty import mywid
27
+from gertty import sync
28
+from gertty.view import project_list as view_project_list
29 29
 
30 30
 palette=[('reversed', 'default,standout', ''),
31 31
          ('header', 'white,bold', 'dark blue'),
@@ -130,7 +130,7 @@ class App(object):
130 130
         self.screens = []
131 131
         self.status = StatusHeader(self)
132 132
         self.header = urwid.AttrMap(self.status, 'header')
133
-        screen = view.project_list.ProjectListView(self)
133
+        screen = view_project_list.ProjectListView(self)
134 134
         self.status.update(title=screen.title)
135 135
         self.loop = urwid.MainLoop(screen, palette=palette,
136 136
                                    unhandled_input=self.unhandledInput)
@@ -221,7 +221,8 @@ class App(object):
221 221
         return gitrepo.Repo(self.config.url+'p/'+project_name,
222 222
                             local_path)
223 223
 
224
-if __name__ == '__main__':
224
+
225
+def main():
225 226
     parser = argparse.ArgumentParser(
226 227
         description='Console client for Gerrit Code Review.')
227 228
     parser.add_argument('-d', dest='debug', action='store_true',
@@ -233,3 +234,7 @@ if __name__ == '__main__':
233 234
     args = parser.parse_args()
234 235
     g = App(args.server, args.debug, args.no_sync)
235 236
     g.run()
237
+
238
+
239
+if __name__ == '__main__':
240
+    main()

+ 5
- 5
gertty/view/change.py View File

@@ -16,10 +16,10 @@ import datetime
16 16
 
17 17
 import urwid
18 18
 
19
-import gitrepo
20
-import mywid
21
-import sync
22
-import view.diff
19
+from gertty import gitrepo
20
+from gertty import mywid
21
+from gertty import sync
22
+from gertty.view import diff as view_diff
23 23
 
24 24
 class ReviewDialog(urwid.WidgetWrap):
25 25
     signals = ['save', 'cancel']
@@ -384,4 +384,4 @@ This Screen
384 384
         return r
385 385
 
386 386
     def diff(self, revision_key):
387
-        self.app.changeScreen(view.diff.DiffView(self.app, revision_key))
387
+        self.app.changeScreen(view_diff.DiffView(self.app, revision_key))

+ 3
- 3
gertty/view/change_list.py View File

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

+ 1
- 1
gertty/view/diff.py View File

@@ -17,7 +17,7 @@ import logging
17 17
 
18 18
 import urwid
19 19
 
20
-import mywid
20
+from gertty import mywid
21 21
 
22 22
 class LineContext(object):
23 23
     def __init__(self, old_revision_key, new_revision_key,

+ 4
- 4
gertty/view/project_list.py View File

@@ -14,9 +14,9 @@
14 14
 
15 15
 import urwid
16 16
 
17
-import mywid
18
-import sync
19
-import view.change_list
17
+from gertty import mywid
18
+from gertty import sync
19
+from gertty.view import change_list as view_change_list
20 20
 
21 21
 class ProjectRow(urwid.Button):
22 22
     project_focus_map = {None: 'reversed',
@@ -113,7 +113,7 @@ This Screen
113 113
         return ret
114 114
 
115 115
     def onSelect(self, button, project_key):
116
-        self.app.changeScreen(view.change_list.ChangeListView(self.app, project_key))
116
+        self.app.changeScreen(view_change_list.ChangeListView(self.app, project_key))
117 117
 
118 118
     def keypress(self, size, key):
119 119
         if key=='l':

+ 1
- 0
requirements.txt View File

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

+ 32
- 0
setup.cfg View File

@@ -0,0 +1,32 @@
1
+[metadata]
2
+name = gertty
3
+summary = Gertty is a console-based interface to the Gerrit Code Review system.
4
+description-file =
5
+    README.rst
6
+author = OpenStack
7
+author-email = openstack-dev@lists.openstack.org
8
+home-page = http://www.openstack.org/
9
+classifier =
10
+    Topic :: Utilities
11
+    Intended Audience :: Developers
12
+    Intended Audience :: Information Technology
13
+    Intended Audience :: System Administrators
14
+    License :: OSI Approved :: Apache Software License
15
+    Operating System :: POSIX :: Linux
16
+    Programming Language :: Python
17
+    Programming Language :: Python :: 2
18
+    Programming Language :: Python :: 2.7
19
+    Programming Language :: Python :: 2.6
20
+keywords = gerrit console urwid review
21
+
22
+[global]
23
+setup-hooks =
24
+    pbr.hooks.setup_hook
25
+
26
+[files]
27
+packages =
28
+    gertty
29
+
30
+[entry_points]
31
+console_scripts =
32
+    gertty = gertty.app:main

+ 20
- 0
setup.py View File

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

Loading…
Cancel
Save