source: TI05-delivery/trunk/setup.py @ 1540

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/trunk/setup.py@1540
Revision 1540, 6.2 KB checked in by spascoe, 13 years ago (diff)

Split the distribution into 3 eggs: server, client and common.

These eggs aren't quite built correctly because they all share a build
directory. To fix this I will split setup.py into 3 in the next commit.

Line 
1"""Built bbftp embedded in python.
2"""
3
4import ez_setup
5ez_setup.use_setuptools()
6
7from setuptools import setup, Extension, Command
8import sys, os
9
10bbftpd_home = './src/bbftp-server-3.2.0'
11bbftpc_home = './src/bbftp-client-3.2.0'
12# Get the version from ./VERSION
13version = open('./VERSION').read()
14
15
16# Not all *.c files are compiled into *.o files in bbftpd
17bbftpd_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    ]
49
50server_sources = ['%s/bbftpd/%s' % (bbftpd_home, x) for x in bbftpd_src] + ['./src/python_ext/bbftpd.c',
51                                                                            './src/python_ext/util.c',
52                                                                            ]
53
54bbftpc_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
86client_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
92class 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
109from setuptools.command.bdist_egg import bdist_egg
110
111class 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
121bbftpd = 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
134bbftpc = 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
145setup(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     
163setup(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
181setup(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      )
Note: See TracBrowser for help on using the repository browser.