Path: blob/main/french/aster/files/patch-as_setup.py
16461 views
--- as_setup.py.orig 2020-10-26 15:54:27 UTC1+++ as_setup.py2@@ -45,6 +45,8 @@ import pprint3import compileall4import imp5import pprint6+import fileinput7+import string8import distutils.sysconfig as SC9from functools import partial10from subprocess import Popen, PIPE11@@ -411,6 +413,7 @@ class SETUP:12archive filename !),13extract_as : rename content.14"""15+ from as_setup import (SYSTEM)16self._print(self._fmt_title % _('Extraction'))17if kargs.get('external')!=None:18self._call_external(**kargs)19@@ -518,6 +521,96 @@ class SETUP:20os.chdir(prev)21if iextr_as:22self.Clean(to_delete=path)23+24+ # Insert FreeBSD patches here25+ file2patch = os.path.join(self.workdir, self.content, 'bibc/wscript')26+ self._print('FreeBSD patch: no libdl => modify ' + file2patch)27+ for ligne in fileinput.input(file2patch, inplace=1):28+ nl = 029+ nl = ligne.find("uselib_store='SYS', lib='dl'")30+ if nl > 0:31+ ligne =ligne.replace("self.check_cc", "# self.check_cc")32+ sys.stdout.write(ligne)33+ file2patch = os.path.join(self.workdir, self.content, 'waftools/med.py')34+ self._print('FreeBSD patch: use hdf5-110 ' + file2patch)35+ for ligne in fileinput.input(file2patch, inplace=1):36+ nl = 037+ nl = ligne.find("self.env.INCLUDEDIR, 'hdf5'")38+ if nl > 0:39+ ligne =ligne.replace("'hdf5'", "'hdf5-110'")40+ sys.stdout.write(ligne)41+ # file2patch = os.path.join(self.workdir, self.content, 'bibcxx/wscript')42+ # self._print('FreeBSD patch: explicit link with libc++ required since Gcc 4.9 => modify ' + file2patch)43+ # for ligne in fileinput.input(file2patch, inplace=1):44+ # nl = 045+ # nl = ligne.find("uselib_store='CXX', lib='stdc++'")46+ # if nl > 0:47+ # ligne =ligne.replace("lib='stdc++'", "lib='c++ stdc++'")48+ # sys.stdout.write(ligne)49+ file2patch = os.path.join(self.workdir, self.content, 'waftools/scotch.py')50+ self._print('FreeBSD patch: int64_t missing => modify ' + file2patch)51+ for ligne in fileinput.input(file2patch, inplace=1):52+ nl = 053+ nl = ligne.find('include "scotch.h"')54+ if nl > 0:55+ sys.stdout.write("#include <sys/types.h>\n")56+ nl = 057+ nl = ligne.find("stdio.h stdlib.h scotch.h")58+ if nl > 0:59+ ligne =ligne.replace("stdlib.h", "stdlib.h sys/types.h")60+ sys.stdout.write(ligne)61+ file2patch = os.path.join(self.workdir, self.content, 'bibc/utilitai/hpalloc.c')62+ self._print('FreeBSD patch: stdlib + no mallopt => modify ' + file2patch)63+ for ligne in fileinput.input(file2patch, inplace=1):64+ nl = 065+ nl = ligne.find('ir=mallopt')66+ if nl > 0:67+ ligne =ligne.replace('ir=mallopt', '/* ir=mallopt')68+ ligne =ligne.replace(');', '); */')69+ else:70+ nl = ligne.find("malloc.h")71+ if nl > 0:72+ ligne =ligne.replace("malloc.h", "stdlib.h")73+ sys.stdout.write(ligne)74+ system=SYSTEM({ 'verbose' : True, 'debug' : False },75+ **{'maxcmdlen' : 2**31, 'log' : self})76+ file2patch = os.path.join(self.workdir, self.content, 'waf.main')77+ self._print('FreeBSD patch: remove extraneous escape => modify waf.main')78+ for ligne in fileinput.input(file2patch, inplace=1):79+ nl = ligne.find("\main$")80+ if nl > 0:81+ ligne =ligne.replace("\main$", "main$")82+ sys.stdout.write(ligne)83+ for f2p in ('waf', 'waf.main', 'waf_variant', 'waf_std', 'waf_mpi', 'bibpyt/Macro/macr_ecre_calc_ops.py'):84+ file2patch = os.path.join(self.workdir, self.content, f2p)85+ self._print('FreeBSD patch: /bin/bash + GNU getopt => modify ' + file2patch)86+ for ligne in fileinput.input(file2patch, inplace=1):87+ nl = 088+ nl = ligne.find("/bin/bash")89+ if nl > 0:90+ ligne =ligne.replace("/bin/bash", " %%LOCALBASE%%/bin/bash")91+ sys.stdout.write(ligne)92+ for ligne in fileinput.input(file2patch, inplace=1):93+ nl = 094+ nl = ligne.find("getopt ")95+ if nl > 0:96+ ligne =ligne.replace("getopt ", "%%LOCALBASE%%/bin/getopt ")97+ sys.stdout.write(ligne)98+ self._print('FreeBSD patches: waf.engine and data/post_install in %s' % os.path.join(self.workdir, self.content))99+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-waf.engine')100+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-data__post_install')101+ self._print('FreeBSD patches: memory detection in bibc/utilitai/mempid.c in %s' % os.path.join(self.workdir, self.content))102+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__utilitai__mempid.c')103+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__supervis__aster_utils.c')104+ file2patch = os.path.join(self.workdir, self.content, 'waftools/mathematics.py')105+ self._print('FreeBSD patch: nproc => gnproc ' + file2patch)106+ for ligne in fileinput.input(file2patch, inplace=1):107+ nl = 0108+ nl = ligne.find("'nproc'")109+ if nl > 0:110+ ligne =ligne.replace("'nproc'", "'gnproc'")111+ sys.stdout.write(ligne)112+ # End of FreeBSD patches113114#-------------------------------------------------------------------------------115def Configure(self, **kargs):116117118