Changeset 1541 for TI05-delivery/trunk


Ignore:
Timestamp:
28/09/06 17:03:56 (13 years ago)
Author:
spascoe
Message:

Major directory structure reorganisation.

The python source tree is now divided into 3 components: common,
server and client. Each component has it's own setup.py.

Do "python setup.py bdist_egg" to create 3 eggs for each component.

Some things in the distribution are now out of sync (e.g. documentation) but
the test cases work (I havn't tried the remote test cases).

Location:
TI05-delivery/trunk
Files:
21 added
2 deleted
4 edited
17 copied

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/examples/deliveryclient.py

    r1538 r1541  
    99import ndg.delivery.client.pybbftp as DC 
    1010 
    11 from ndg.delivery.auth_plugin import * 
     11from ndg.delivery.common.auth_plugin import * 
    1212 
    1313def makeClient(username, hostname): 
  • TI05-delivery/trunk/examples/deliveryd.py

    r1538 r1541  
    1414 
    1515import ndg.delivery.server.pybbftp as server 
    16 from ndg.delivery.auth_plugin import * 
     16from ndg.delivery.common.auth_plugin import * 
    1717 
    1818 
  • TI05-delivery/trunk/setup.py

    r1540 r1541  
    11"""Built bbftp embedded in python. 
     2 
     3This is a meta-setup to run setup.py on the 3 separate components. 
     4 
    25""" 
    36 
    4 import ez_setup 
    5 ez_setup.use_setuptools() 
    6  
    7 from setuptools import setup, Extension, Command 
    87import sys, os 
    98 
    10 bbftpd_home = './src/bbftp-server-3.2.0' 
    11 bbftpc_home = './src/bbftp-client-3.2.0' 
    12 # Get the version from ./VERSION 
    13 version = open('./VERSION').read() 
     9#!TODO: Documentation generation is broken since moving to 3 separate components 
     10## class Doc(Command): 
     11##     """Build epydoc and doxygen documentation. 
     12##     """ 
     13 
     14##     user_options = [] 
     15 
     16##     def initialize_options(self): 
     17##         pass 
     18##     def finalize_options(self): 
     19##         pass 
     20 
     21##     def run(self): 
     22##         cmd = ('epydoc -o doc/epydoc -v --docformat javadoc ' 
     23##                '--name "NDG Delivery Service" build/lib*/pybbftp/') 
     24##         self.execute(os.system, (cmd,)) 
     25##         self.execute(os.system, ('doxygen',)) 
    1426 
    1527 
    16 # Not all *.c files are compiled into *.o files in bbftpd 
    17 bbftpd_src = [ 
    18     'bbftpd.c', 
    19     'bbftpd_cd.c', 
    20     'bbftpd_check.c', 
    21     'bbftpd_crypt.c', 
    22     'bbftpd_daemon.c', 
    23     'bbftpd_list.c', 
    24     'bbftpd_login.c', 
    25     'bbftpd_message.c', 
    26     'bbftpd_mkdir.c', 
    27     'bbftpd_rm.c', 
    28     'bbftpd_stat.c', 
    29     'bbftpd_statfs.c', 
    30     'bbftpd_readcontrol.c', 
    31     'bbftpd_retr.c', 
    32     'bbftpd_signals.c', 
    33     'bbftpd_socket.c', 
    34     'bbftpd_store.c', 
    35     'bbftpd_utils.c', 
    36     'changetodir.c', 
    37     'createadir.c', 
    38     'createreceivesock.c', 
    39     'readcontrol.c', 
    40     'sendafile.c', 
    41     'sendlist.c', 
    42     'signals_routines.c', 
    43     'storeafile.c', 
    44     'bbftpd_private.c', 
    45     'bbftpd_private_user.c', 
    46     'bbftpd_private_log.c', 
    47     'bbftpd_private_fork.c' 
    48     ] 
     28def doSetup(dir): 
     29    dist_dir = os.getcwd() 
     30    os.chdir(dir) 
     31    execfile('setup.py') 
     32    os.chdir(dist_dir) 
    4933 
    50 server_sources = ['%s/bbftpd/%s' % (bbftpd_home, x) for x in bbftpd_src] + ['./src/python_ext/bbftpd.c', 
    51                                                                             './src/python_ext/util.c', 
    52                                                                             ] 
     34if not os.path.exists('./dist'): 
     35    os.mkdir('./dist') 
    5336 
    54 bbftpc_src = [  
    55     'bbftp_cd.c', 
    56     'bbftp_get.c', 
    57     'bbftp_lcd.c', 
    58     'bbftp_list.c', 
    59     'bbftp_mget.c', 
    60     'bbftp_mkdir.c', 
    61     'bbftp_mput.c', 
    62     'bbftp_put.c', 
    63     'bbftp_rm.c', 
    64     'bbftp_stat.c', 
    65     'bbftp_statfs.c', 
    66     'bbftp_dir.c', 
    67     'bbftp_retr.c', 
    68     'bbftp_setremotecos.c', 
    69     'bbftp_setremoteumask.c', 
    70     'bbftp_store.c', 
    71     'bbftp_socket.c', 
    72     'bbftp_utils.c', 
    73     'connecttoserver.c', 
    74     'getdatasock.c', 
    75     'readmessage.c', 
    76     'sendproto.c', 
    77     'treatcommand.c', 
    78     'bbftp_turl.c', 
    79     'writemessage.c', 
    80     'setsignals.c', 
    81     'bbftp_private.c', 
    82     'bbftp_private_user.c', 
    83     'ndg_client.c' 
    84     ] 
    85  
    86 client_sources = ['%s/bbftpc/%s' % (bbftpc_home, x) for x in bbftpc_src] + ['./src/python_ext/bbftpc.c',  
    87                                                                             './src/python_ext/util.c', 
    88                                                                             './src/python_ext/bbftpc_main.c'] 
    89  
    90 #------------------------------------------------------------------------------------------- 
    91  
    92 class Doc(Command): 
    93     """Build epydoc and doxygen documentation. 
    94     """ 
    95  
    96     user_options = [] 
    97  
    98     def initialize_options(self): 
    99         pass 
    100     def finalize_options(self): 
    101         pass 
    102  
    103     def run(self): 
    104         cmd = ('epydoc -o doc/epydoc -v --docformat javadoc ' 
    105                '--name "NDG Delivery Service" build/lib*/pybbftp/') 
    106         self.execute(os.system, (cmd,)) 
    107         self.execute(os.system, ('doxygen',)) 
    108  
    109 from setuptools.command.bdist_egg import bdist_egg 
    110  
    111 class MyBuild(bdist_egg): 
    112     def run(self): 
    113         # We make the stand-alone client/server here for 2 reasons: The source must be 
    114         # configured by the respective bbftp configure scripts and some test cases use 
    115         # the stand-alone client. 
    116         self.spawn(['make', '-C', 'src']) 
    117         bdist_egg.run(self) 
    118  
    119 #------------------------------------------------------------------------------------------- 
    120  
    121 bbftpd = Extension('ndg.delivery.server.bbftpd', 
    122                    define_macros = [('NDG_AUTH', 1), 
    123                                     ('LOCAL_SYSLOG_FACILITY', 1), 
    124                                     ('_LARGEFILE64_SOURCE', 1), 
    125                                     ('_FILE_OFFSET_BITS', 64), 
    126                                     ('NDG_PYTHON_EMBED', 1), 
    127                                     ('PRIVATE_LOGGING', 1), 
    128                                     ('NDG_DELIVERY_VERSION', version)], 
    129                    include_dirs = [bbftpd_home+'/includes', bbftpd_home+'/bbftpd'], 
    130                    libraries = ['crypt', 'crypto'], 
    131                    extra_compile_args = ["-O1", "-Wno-strict-prototypes"], 
    132                    sources = server_sources) 
    133  
    134 bbftpc = Extension('ndg.delivery.client.bbftpc', 
    135                    define_macros = [('NDG_AUTH', 1), ('LOCAL_SYSLOG_FACILITY', 1), 
    136                                     ('_LARGEFILE64_SOURCE', 1), 
    137                                     ('_FILE_OFFSET_BITS', 64), 
    138                                     ('NDG_PYTHON_EMBED', 1), 
    139                                     ('NDG_DELIVERY_VERSION', version)], 
    140                    include_dirs = [bbftpc_home+'/includes', bbftpc_home+'/bbftpc'], 
    141                    libraries = ['crypt', 'crypto'], 
    142                    extra_compile_args = ["-O1", "-Wno-strict-prototypes"], 
    143                    sources = client_sources) 
    144  
    145 setup(name = 'ndg_delivery_server', 
    146       version = version, 
    147       description = 'Embedded bbftp server', 
    148       author = 'Stephen Pascoe', 
    149       author_email = 'S.Pascoe@rl.ac.uk', 
    150  
    151       zip_safe = True, 
    152       install_requires = ['setuptools'], 
    153       package_requires = ['ndg_delivery_common'], 
    154  
    155       packages = ['ndg', 'ndg.delivery', 'ndg.delivery.server'], 
    156       namespace_packages = ['ndg', 'ndg.delivery'], 
    157       package_dir = {'': 'lib/python'}, 
    158       scripts=['examples/deliveryd.py'], 
    159       ext_modules = [bbftpd], 
    160       cmdclass = {'doc': Doc, 'bdist_egg': MyBuild} 
    161       ) 
    162        
    163 setup(name = 'ndg_delivery_client', 
    164       version = version, 
    165       description = 'Embedded bbftp client', 
    166       author = 'Stephen Pascoe', 
    167       author_email = 'S.Pascoe@rl.ac.uk', 
    168  
    169       zip_safe = True, 
    170       install_requires = ['setuptools'], 
    171       package_requires = ['ndg_delivery_common'], 
    172  
    173       packages = ['ndg', 'ndg.delivery', 'ndg.delivery.client'], 
    174       namespace_packages = ['ndg', 'ndg.delivery'], 
    175       package_dir = {'': 'lib/python'}, 
    176       scripts=['examples/deliveryclient.py'], 
    177       ext_modules = [bbftpc], 
    178       cmdclass = {'doc': Doc, 'bdist_egg': MyBuild} 
    179       ) 
    180  
    181 setup(name = 'ndg_delivery_common', 
    182       version = version, 
    183       description = 'Common components for NDG DeliveryService client and server', 
    184       author = 'Stephen pascoe', 
    185       author_email = 'S.Pascoe@rl.ac.uk', 
    186  
    187       zip_safe = True, 
    188       install_requires = ['setuptools'], 
    189  
    190       packages = ['ndg', 'ndg.delivery', 'ndg.delivery.common'], 
    191       namespace_packages = ['ndg', 'ndg.delivery'], 
    192       package_dir = {'': 'lib/python'}, 
    193       cmdclass = {'doc': Doc} 
    194       ) 
     37for c in ('common', 'server', 'client'): 
     38    print 'Seting up component %s' % c 
     39    doSetup('./components/%s' % c) 
     40    os.system('cp ./components/%s/dist/*.egg ./dist' % c) 
  • TI05-delivery/trunk/test/runclient.py

    r1539 r1541  
    1010 
    1111 
    12 from ndg.delivery.auth_plugin import AuthClientHandler 
     12from ndg.delivery.common.auth_plugin import AuthClientHandler 
    1313import ndg.delivery.client.pybbftp as DC 
    1414 
Note: See TracChangeset for help on using the changeset viewer.