forked from sthaber/pynfs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·127 lines (110 loc) · 4.28 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env python
DESCRIPTION = """\
pynfs is a collection of tools and libraries for NFS4. It includes
a NFS4 library and a server test application.
"""
import sys
from distutils.core import setup, Extension
from distutils.dep_util import newer_group
import os
import glob
topdir = os.getcwd()
if __name__ == "__main__":
if os.path.isfile(os.path.join(topdir, 'lib', 'testmod.py')):
sys.path.insert(1, os.path.join(topdir, 'lib'))
import rpcgen
def needs_updating(xdrfile):
gen_path = os.path.join(topdir, 'lib', 'rpcgen.py')
name_base = xdrfile[:xdrfile.rfind(".")]
sources = [gen_path, xdrfile]
targets = [ name_base + "_const.py",
name_base + "_type.py",
name_base + "_pack.py" ]
for t in targets:
if newer_group(sources, t):
return True
return False
def use_xdr(dir, xdrfile):
"""Move to dir, and generate files based on xdr file"""
os.chdir(dir)
if needs_updating(xdrfile):
rpcgen.run(xdrfile)
for file in glob.glob(os.path.join(dir, 'parse*')):
print "deleting", file
os.remove(file)
def generate_files():
home = os.getcwd()
dir = os.path.join(topdir, 'lib', 'nfs4')
use_xdr(dir, 'nfs4.x')
import ops_gen # this must be delayed until nfs4.x is parsed
sources = [ os.path.join(topdir, 'lib', 'ops_gen.py'),
'nfs4_const.py', 'nfs4_type.py' ]
if newer_group(sources, 'nfs4_ops.py'):
print "Generating nfs4_ops.py"
ops_gen.run()
dir = os.path.join(topdir, 'lib', 'rpc')
use_xdr(dir, 'rpc.x')
dir = os.path.join(topdir, 'lib', 'rpc', 'rpcsec')
use_xdr(dir, 'gss.x')
dir = os.path.join(topdir, 'lib', 'nlm')
use_xdr(dir, 'nlm_prot.x')
dir = os.path.join(topdir, 'lib', 'nsm')
use_xdr(dir, 'nsm.x')
# Handle NFS3
dir = os.path.join(topdir, 'lib', 'nfs3')
use_xdr(dir, 'nfs3.x')
use_xdr(dir, 'mount.x')
use_xdr(dir, 'rpcb.x')
use_xdr(dir, 'acl.x')
os.chdir(home)
# FRED - figure how to get this to run only with build/install type command
generate_files()
# Describes how to compile gssapi.so - change this as needed
# FRED - is there a general way to look this info up?
# FRED - for use out of package root, is there a way to place compiled library with source?
if os.path.exists('/usr/include/heimdal'):
# This works with Heimdal kerberos (Suse)
gssapi = Extension('rpc.rpcsec._gssapi',
extra_compile_args = ['-Wall'],
define_macros = [('HEIMDAL',1)],
include_dirs = ['/usr/kerberos/include',
'/usr/include/heimdal'],
libraries = ['gssapi'],
library_dirs = ['/usr/kerberos/lib'],
sources = ['lib/rpc/rpcsec/gssapi_wrap.c'])
else:
# This works with MIT kerberos (Fedora)
gssapi = Extension('rpc.rpcsec._gssapi',
extra_compile_args = ['-Wall'],
include_dirs = ['/usr/kerberos/include'],
libraries = ['gssapi_krb5'],
library_dirs = ['/usr/kerberos/lib'],
sources = ['lib/rpc/rpcsec/gssapi_wrap.c'])
portmap = Extension('nlm.portmap',
extra_compile_args = ['-Wall'],
include_dirs = ['/usr/local/include'],
sources = ['lib/nlm/portmap.c'])
from testserver import VERSION
setup(name = "newpynfs",
version = VERSION,
license = "GPL",
description = "Python NFS4 tools",
long_description = DESCRIPTION,
author = "Fred Isaman",
author_email = "iisaman@citi.umich.edu",
maintainer = "Fred Isaman",
maintainer_email = "iisaman@citi.umich.edu",
ext_modules = [gssapi,portmap],
package_dir = {'': 'lib'},
packages = ['nfs4', 'nfs4.servertests', 'ply', 'rpc', 'rpc.rpcsec',
'nfs3', 'nfs3.servertests', 'nlm', 'nsm'],
py_modules = ['testmod', 'rpcgen', 'pexpect'],
scripts = ['testserver.py', 'showresults.py']
)
PATHHELP = """\
See http://www.python.org/doc/current/inst/search-path.html for detailed
information on various ways to set the search path.
One easy way is to set the environment variable PYTHONPATH.
"""
if "install" in sys.argv:
print PATHHELP