Eine gängige Methode zum Erstellen von Quellcode auf * NIX-Plattformen ist die Verwendung eines configure
-Skripts. Unter der Haube versucht configure, eine Reihe von Testprogrammen zu erstellen, um festzustellen, auf welche Bibliotheken Sie zugreifen können. Es erzeugt dann eine Headerdatei, die in das Projekt aufgenommen wird, das eine Reihe von Makros bedingt definiert, so dass der Programmierer eine Alternative bereitstellen oder eine abgespeckte Version einer Bibliothek/eines Programms erstellen kann, wenn eine bestimmte "Abhängigkeit" fehlt. Gibt es eine funktional äquivalente Verwendung von ?numpy distutils - Versuchen Sie, etwas zu kompilieren und Flags zu setzen, wenn Sie fehlschlagen
Als Beispiel ist hier mein setup.py
:
from numpy.distutils.misc_util import Configuration
def configuration(parent_package='',top_path=None):
config = Configuration('pyggcm',parent_package,top_path)
#TODO: Currently, I have some macros to conditionally build the seek-code
#Unfortunately, that's not the best solution (by far). Perhaps if we
#changed to using stream access it would work better, without the need
#for these silly macros.
config.add_extension('_fortfile',sources=['_fortfile/_fortfile.F90'],
define_macros=[
('FSEEKABLE',1), #compiler provides fseek and ftell
('HAVE_STREAM',1) #compiler provides access='stream' for opening files. (f2003 standard)
])
config.add_extension('jrrle',sources=['jrrle/jrrle.f90'])
config.add_scripts(['scripts/ggcm_timehist',
'scripts/ggcm_plasmasheet',
'scripts/ggcm_plot'])
return config
from numpy.distutils.core import setup
setup(configuration=configuration)
Dieses bedingungslos baut die FSEEKABLE
Code und müssten manuell, wenn der Fortran-Compiler, der (Die Makros wickeln die fseek
nicht unterstützt Benutzer bearbeitet werden und ftell
GNU intrinsische Funktion). Gibt es eine Möglichkeit festzustellen, ob der Fortran-Compiler diese intrinsischen Funktionen liefert?
Fehlende Wort: * ... Build-Tools wie kann ... *? – Tshepang