Reorganize namespace

There were too many packages with only a couple of modules
in them. It took minimum four tab completes to find an
interesting file. This halves that.
This commit is contained in:
Michael Spang 2007-12-13 03:39:05 -05:00
parent 9a56175919
commit b8be0f8149
29 changed files with 45 additions and 99 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/python #!/usr/bin/python
import csc.apps.urwid.main import ceo.urwid.main
csc.apps.urwid.main.start() ceo.urwid.main.start()

View File

@ -3,7 +3,7 @@
ceoquery - a script to lookup member and account information ceoquery - a script to lookup member and account information
""" """
import os, sys import os, sys
from csc.adm import members, terms from ceo import members, terms
try: try:
members.connect() members.connect()

View File

@ -9,8 +9,8 @@ When run from an unprivileged account, authentication will be performed
before the account information is changed. before the account information is changed.
""" """
import os, sys, pwd, getopt, PAM import os, sys, pwd, getopt, PAM
from csc.common.excep import InvalidArgument from ceo import accounts
from csc.adm import accounts from ceo.excep import InvalidArgument
progname = os.path.basename(sys.argv[0]) progname = os.path.basename(sys.argv[0])

View File

@ -9,8 +9,8 @@ When run from an unprivileged account, authentication will be performed
before the shell is changed, and the new shell must be listed in /etc/shells. before the shell is changed, and the new shell must be listed in /etc/shells.
""" """
import os, sys, pwd, getopt, PAM import os, sys, pwd, getopt, PAM
from csc.common.excep import InvalidArgument from ceo import accounts
from csc.adm import accounts from ceo.excep import InvalidArgument
progname = os.path.basename(sys.argv[0]) progname = os.path.basename(sys.argv[0])

1
ceo/__init__.py Normal file
View File

@ -0,0 +1 @@
"""CSC Electronic Office"""

View File

@ -10,9 +10,8 @@ Future changes to the members database that need to be atomic
must also be moved into this module. must also be moved into this module.
""" """
import re, subprocess, ldap import re, subprocess, ldap
from csc.common import conf from ceo import conf, excep, ldapi
from csc.common.excep import InvalidArgument from ceo.excep import InvalidArgument
from csc.backends import ldapi
### Configuration ### ### Configuration ###

View File

@ -233,7 +233,7 @@ def next_unregistered(registered):
if __name__ == '__main__': if __name__ == '__main__':
from csc.common.test import * from ceo.test import test, assert_equal, success
test(parse); assert_equal(110, parse('f2006')); success() test(parse); assert_equal(110, parse('f2006')); success()
test(generate); assert_equal('f2006', generate(110)); success() test(generate); assert_equal('f2006', generate(110)); success()

1
ceo/urwid/__init__.py Normal file
View File

@ -0,0 +1 @@
"""Urwid User Interface"""

View File

@ -1,10 +1,9 @@
import urwid, pwd, grp import urwid
from csc.apps.urwid.widgets import * from ceo import members
from csc.apps.urwid.window import * from ceo.excep import InvalidArgument
import csc.apps.urwid.search as search from ceo.urwid import search
from ceo.urwid.widgets import *
from csc.adm import members from ceo.urwid.window import *
from csc.common.excep import InvalidArgument
def menu_items(items): def menu_items(items):
return [ urwid.AttrWrap( ButtonText( cb, data, txt ), 'menu', 'selected') for (txt, cb, data) in items ] return [ urwid.AttrWrap( ButtonText( cb, data, txt ), 'menu', 'selected') for (txt, cb, data) in items ]

View File

@ -1,10 +1,8 @@
import urwid import urwid
from ceo import members
from csc.apps.urwid.widgets import * from ceo.excep import InvalidArgument
from csc.apps.urwid.window import * from ceo.urwid.widgets import *
from ceo.urwid.window import *
from csc.adm import members
from csc.common.excep import InvalidArgument
class InfoPage(WizardPanel): class InfoPage(WizardPanel):
def init_widgets(self): def init_widgets(self):

View File

@ -1,16 +1,9 @@
import random, ldap, urwid.curses_display import random, ldap, urwid.curses_display
from ceo import members, terms
from csc.apps.urwid.widgets import * from ceo.excep import InvalidArgument
from csc.apps.urwid.window import * from ceo.urwid.widgets import *
import csc.apps.urwid.newmember as newmember from ceo.urwid.window import *
import csc.apps.urwid.renew as renew from ceo.urwid import newmember, renew, info, search, positions, groups
import csc.apps.urwid.info as info
import csc.apps.urwid.search as search
import csc.apps.urwid.positions as positions
import csc.apps.urwid.groups as groups
from csc.adm import members, terms
from csc.common.excep import InvalidArgument
ui = urwid.curses_display.Screen() ui = urwid.curses_display.Screen()

View File

@ -1,9 +1,8 @@
import urwid import urwid
from csc.apps.urwid.widgets import * from ceo import members, terms
from csc.apps.urwid.window import * from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from csc.adm import members, terms from ceo.urwid.window import *
from csc.common.excep import InvalidArgument
class IntroPage(WizardPanel): class IntroPage(WizardPanel):
def init_widgets(self): def init_widgets(self):

View File

@ -1,9 +1,8 @@
import urwid import urwid
from csc.apps.urwid.widgets import * from ceo import members
from csc.apps.urwid.window import * from ceo.excep import InvalidArgument
from ceo.urwid.widgets import *
from csc.adm import members from ceo.urwid.window import *
from csc.common.excep import InvalidArgument
position_data = [ position_data = [
('president', 'President'), ('president', 'President'),

View File

@ -1,9 +1,7 @@
import urwid import urwid
from ceo import members, terms
from csc.apps.urwid.widgets import * from ceo.urwid.widgets import *
from csc.apps.urwid.window import * from ceo.urwid.window import *
from csc.adm import members, terms
class IntroPage(WizardPanel): class IntroPage(WizardPanel):
def init_widgets(self): def init_widgets(self):

View File

@ -1,10 +1,8 @@
import urwid import urwid
from ceo import members, terms
from csc.apps.urwid.widgets import * from ceo.excep import InvalidArgument
from csc.apps.urwid.window import * from ceo.urwid.widgets import *
from ceo.urwid.window import *
from csc.adm import members, terms
from csc.common.excep import InvalidArgument
class TermPage(WizardPanel): class TermPage(WizardPanel):
def init_widgets(self): def init_widgets(self):

View File

@ -1,6 +1,6 @@
import urwid import urwid
from csc.apps.urwid.ldapfilter import * from ceo.urwid.ldapfilter import *
from csc.apps.urwid.window import raise_back, push_window from ceo.urwid.window import raise_back, push_window
def push_wizard(name, pages, dimensions=(50, 10)): def push_wizard(name, pages, dimensions=(50, 10)):
state = {} state = {}

View File

@ -1,5 +0,0 @@
"""
Computer Science Club Python Modules
The csc module is a container for all CSC-specific Python modules.
"""

View File

@ -1,8 +0,0 @@
"""
CSC Administrative Modules
This module provides member and account management modules.
members - member registration management functions
terms - helper routines for manipulating terms
"""

View File

@ -1,8 +0,0 @@
"""
Application-style User Interfaces
This module contains large frontends with many functions
and fancy graphical user interfaces.
legacy - aims to reproduce the curses UI of the previous CEO
"""

View File

@ -1,3 +0,0 @@
"""
Urwid User Interface
"""

View File

@ -1,7 +0,0 @@
"""
Backend Modules
This module contains backend interfaces and related modules.
ldapi - LDAP interface for UNIX account attribute administration
"""

View File

@ -1,7 +0,0 @@
"""
Generally Useful Common Modules
conf - simple configuration file reader
excep - generally useful exceptions
test - test suite utility routines
"""

View File

@ -5,8 +5,7 @@ from distutils.core import setup
setup( setup(
name='ceo', name='ceo',
description='CSC Electronic Office', description='CSC Electronic Office',
packages=[ 'csc', 'csc.common', 'csc.adm', 'csc.backends', 'csc.apps', 'csc.apps.urwid' ], packages=[ 'ceo', 'ceo.urwid' ],
package_dir = {'': 'pylib'},
scripts=['bin/ceo', 'bin/ceoquery', 'bin/csc-chfn', 'bin/csc-chsh'], scripts=['bin/ceo', 'bin/ceoquery', 'bin/csc-chfn', 'bin/csc-chsh'],
) )