1 from distutils
.core
import Extension
, setup
2 from distutils
import sysconfig
7 def find_file(filename
, std_dirs
, paths
):
8 """Searches for the directory where a given file is located,
9 and returns a possibly-empty list of additional directories, or None
10 if the file couldn't be found at all.
12 'filename' is the name of a file, such as readline.h or libcrypto.a.
13 'std_dirs' is the list of standard system directories; if the
14 file is found in one of them, no additional directives are needed.
15 'paths' is a list of additional locations to check; if the file is
16 found in one of them, the resulting list will contain the directory.
19 # Check the standard locations
21 f
= os
.path
.join(dir, filename
)
22 if os
.path
.exists(f
): return []
24 # Check the additional directories
26 f
= os
.path
.join(dir, filename
)
33 def find_library_file(compiler
, libname
, std_dirs
, paths
):
34 filename
= compiler
.library_filename(libname
, lib_type
='shared')
35 result
= find_file(filename
, std_dirs
, paths
)
36 if result
is not None: return result
38 filename
= compiler
.library_filename(libname
, lib_type
='static')
39 result
= find_file(filename
, std_dirs
, paths
)
42 def waste_Extension():
43 waste_incs
= find_file("WASTE.h", [],
44 ['../'*n
+ 'waste/C_C++ Headers' for n
in (0,1,2,3,4)])
45 if waste_incs
!= None:
46 waste_libs
= [os
.path
.join(os
.path
.split(waste_incs
[0])[0], "Static Libraries")]
48 return [ Extension('waste',
49 [os
.path
.join(srcdir
, d
) for d
in
50 'Mac/Modules/waste/wastemodule.c',
51 'Mac/Wastemods/WEObjectHandlers.c',
52 'Mac/Wastemods/WETabHooks.c',
53 'Mac/Wastemods/WETabs.c'
55 include_dirs
= waste_incs
+ [
56 os
.path
.join(srcdir
, 'Mac/Include'),
57 os
.path
.join(srcdir
, 'Mac/Wastemods')
59 library_dirs
= waste_libs
,
60 libraries
= ['WASTE'],
61 extra_link_args
= ['-framework', 'Carbon'],
65 setup(name
="MacPython for Jaguar extensions", version
="2.2",
67 Extension("OverrideFrom23._AE",
68 [SRCDIR
+ "/Mac/Modules/ae/_AEmodule.c"],
69 include_dirs
=[SRCDIR
+"/Mac/Include"],
70 extra_link_args
=['-framework', 'Carbon']),
71 Extension("OverrideFrom23._Res",
72 [SRCDIR
+ "/Mac/Modules/res/_Resmodule.c"],
73 include_dirs
=[SRCDIR
+"/Mac/Include"],
74 extra_link_args
=['-framework', 'Carbon']),
76 [SRCDIR
+ '/Mac/Modules/help/_Helpmodule.c'],
77 include_dirs
=[SRCDIR
+"/Mac/Include"],
78 extra_link_args
=['-framework', 'Carbon']),
80 [SRCDIR
+ '/Mac/Modules/scrap/_Scrapmodule.c'],
81 include_dirs
=[SRCDIR
+"/Mac/Include"],
82 extra_link_args
=['-framework', 'Carbon']),