Changeset 7599:584fb51a671c
- Timestamp:
- 12/10/07 14:22:43 (5 years ago)
- Branch:
- default
- Parents:
- 7572:61c96b713e46 (diff), 7598:610450e0810d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r7570 r7599 881 881 ), \ 882 882 883 Extension('sage.rings.polynomial.pbori', 884 sources = ['sage/rings/polynomial/pbori.pyx'], 885 libraries=['polybori','pboriCudd','groebner'], 886 include_dirs=[SAGE_ROOT+'/local/include/cudd', 887 SAGE_ROOT+'/local/include/polybori', 888 SAGE_ROOT+'/local/include/polybori/groebner'], 889 language = 'c++'), \ 883 890 884 891 ] -
setup.py
r7598 r7599 9 9 from distutils.extension import Extension 10 10 from Cython.Distutils import build_ext 11 12 13 11 14 12 ## Choose cblas library -- note -- make sure to update sage/misc/cython.py … … 206 204 "sage/libs/mwrank/wrap.cc"], 207 205 define_macros = [("NTL_ALL",None)], 208 libraries = [" mwrank", "ntl", "gmp", "gmpxx", "stdc++", "m", "pari"])206 libraries = ["curvesntl", "g0nntl", "jcntl", "rankntl", "ntl", "gmp", "gmpxx", "stdc++", "m", "pari"]) 209 207 210 208 pari = Extension('sage.libs.pari.gen', … … 921 919 ###################################################################### 922 920 923 def check_dependencies( filename, outfile):921 def get_dependencies(filename): 924 922 """ 925 INPUT: 926 filename -- The name of a .pyx, .pxd, or .pxi to check dependencies in the SAGE source. 927 outfile -- The output file for which we are determining out-of-date-ness 928 929 OUTPUT: 930 bool -- whether or not outfile must be regenerated. 923 computes everything that this file depends on 931 924 """ 932 if is_older(filename, outfile): 933 print "\nBuilding %s because it depends on %s."%(outfile, filename) 934 return True 935 925 li = [] 936 926 # Now we look inside the file to see what it cimports or include. 937 927 # If any of these files are newer than outfile, we rebuild … … 971 961 # Check to see if a/b/c/d.pxd exists and is newer than filename. 972 962 # If so, we have to regenerate outfile. If not, we're safe. 973 if os.path.exists(A) and check_dependencies(A, outfile): 974 return True # yep we must rebuild 963 A = os.path.normpath(A) 964 if os.path.exists(A): 965 li.extend(get_dependencies(A)) 966 li.append(A) 975 967 976 968 # OK, next we move on to include pxi files. … … 1000 992 A = R # restore 1001 993 # Finally, check to see if filename is older than A 1002 if os.path.exists(A) and check_dependencies(A, outfile): 994 A = os.path.normpath(A) 995 if os.path.exists(A): 996 li.extend(get_dependencies(A)) 997 li.append(A) 998 999 # if we get here, this file depends on nothing 1000 return li 1001 1002 def check_dependencies(filename, outfile, deps_of): 1003 """ 1004 INPUT: 1005 filename -- The name of a .pyx, .pxd, or .pxi to check dependencies in the SAGE source. 1006 outfile -- The output file for which we are determining out-of-date-ness 1007 1008 OUTPUT: 1009 bool -- whether or not outfile must be regenerated. 1010 """ 1011 # add filename to depend on filename 1012 try: 1013 deps = deps_of[filename] 1014 except KeyError: 1015 return True 1016 1017 for dep in deps: 1018 if is_older(dep, outfile): 1019 print "\nBuilding %s because it depends on %s."%(outfile, dep) 1003 1020 return True 1004 1021 1005 1006 def need_to_cython(filename, outfile): 1022 def need_to_cython(filename, outfile, deps): 1007 1023 """ 1008 1024 INPUT: 1009 1025 filename -- The name of a cython file in the SAGE source tree. 1010 1026 outfile -- The name of the corresponding c or cpp file in the build directory. 1027 deps -- a structure containing dependency information 1011 1028 1012 1029 OUTPUT: … … 1017 1034 pxd = base+'.pxd' 1018 1035 1019 if check_dependencies(filename, outfile ):1036 if check_dependencies(filename, outfile, deps): 1020 1037 return True 1021 elif os.path.exists(pxd) and check_dependencies(pxd, outfile):1038 if os.path.exists(pxd) and check_dependencies(pxd, outfile, deps): 1022 1039 return True 1023 else: 1024 return False 1025 1026 def process_cython_file(f, m): 1040 return False 1041 1042 def process_cython_file(f, m, deps_of): 1027 1043 """ 1028 1044 INPUT: … … 1032 1048 # This is a cython file, so process accordingly. 1033 1049 pyx_inst_file = '%s/%s'%(SITE_PACKAGES, f) 1050 # if f is *more recent* than the pyx_install_file 1034 1051 if is_older(f, pyx_inst_file): 1035 1052 print "%s --> %s"%(f, pyx_inst_file) 1036 1053 os.system('cp %s %s 2>/dev/null'%(f, pyx_inst_file)) 1054 # we need to recompute the dependencies, here 1055 deps_list = get_dependencies(f) 1056 try: 1057 deps_of[f].extend(deps_list) 1058 except KeyError: 1059 deps_of[f] = deps_list 1037 1060 outfile = f[:-4] + ".c" 1038 1061 if m.language == 'c++': 1039 1062 outfile += 'pp' 1040 1063 1041 if need_to_cython(f, outfile ):1064 if need_to_cython(f, outfile, deps_of): 1042 1065 # Insert the -o parameter to specify the output file (particularly for c++) 1043 cmd = "cython --embed-positions --incref-local-binop -I%s -o %s %s"%(os.getcwd(), outfile, f )1066 cmd = "cython --embed-positions --incref-local-binop -I%s -o %s %s"%(os.getcwd(), outfile, f ) 1044 1067 print cmd 1045 1068 ret = os.system(cmd) … … 1047 1070 print "sage: Error running cython." 1048 1071 sys.exit(1) 1072 1049 1073 return [outfile] 1050 1074 1051 1075 1052 1076 def cython(ext_modules): 1077 import pickle 1078 deps_filename = SAGE_DEVEL + 'sage/.cython_dependencies' 1079 # check if the cached dependency information is there 1080 if os.path.exists(deps_filename): 1081 deps_file = open(deps_filename, 'r') 1082 deps_of = pickle.load(deps_file) 1083 deps_file.close() 1084 deps_file = None 1085 compute_all_deps = False 1086 else: 1087 compute_all_deps = True 1088 deps_of = {} 1089 1090 tot = 0 1053 1091 for m in ext_modules: 1054 1092 m.extra_compile_args += extra_compile_args … … 1057 1095 for i in range(len(m.sources)): 1058 1096 f = m.sources[i] 1059 # s = open(f).read() 1097 if compute_all_deps: 1098 deps_list = get_dependencies(f) 1099 try: 1100 deps_of[f].extend(deps_list) 1101 except KeyError: 1102 deps_of[f] = deps_list 1103 pxd_file = f[:-4] + '.pxd' 1104 if os.path.exists(pxd_file): 1105 deps_list = get_dependencies(pxd_file) 1106 try: 1107 deps_of[pxd_file].extend(deps_list) 1108 except KeyError: 1109 deps_of[pxd_file] = deps_list 1110 1060 1111 if f[-4:] == ".pyx": 1061 new_sources += process_cython_file(f, m) 1112 # run cython, to output the corresponding c/cpp file, 1113 # if needed 1114 new_sources += process_cython_file(f, m, deps_of) 1062 1115 else: 1063 1116 new_sources.append(f) 1117 1064 1118 m.sources = new_sources 1065 1066 1119 tot += len(m.sources) 1120 1121 # now cache the dependencies if we just computed them 1122 deps_file = open(deps_filename, 'w') 1123 pickle.dump(deps_of, deps_file) 1124 deps_file.close() 1067 1125 1068 1126 if not sdist: … … 1153 1211 1154 1212 'sage.monoids', 1213 1214 'sage.numerical', 1155 1215 1156 1216 'sage.plot',
Note: See TracChangeset
for help on using the changeset viewer.
