Path: blob/main/french/aster/files/patch-as_setup.py
16136 views
--- as_setup.py.orig 2020-10-26 15:54:27 UTC1+++ as_setup.py2@@ -45,6 +45,8 @@ import tarfile3import 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,88 @@ 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, 'bibcxx/wscript')34+ # self._print('FreeBSD patch: explicit link with libc++ required since Gcc 4.9 => modify ' + file2patch)35+ # for ligne in fileinput.input(file2patch, inplace=1):36+ # nl = 037+ # nl = ligne.find("uselib_store='CXX', lib='stdc++'")38+ # if nl > 0:39+ # ligne =ligne.replace("lib='stdc++'", "lib='c++ stdc++'")40+ # sys.stdout.write(ligne)41+ file2patch = os.path.join(self.workdir, self.content, 'waftools/scotch.py')42+ self._print('FreeBSD patch: int64_t missing => modify ' + file2patch)43+ for ligne in fileinput.input(file2patch, inplace=1):44+ nl = 045+ nl = ligne.find('include "scotch.h"')46+ if nl > 0:47+ sys.stdout.write("#include <sys/types.h>\n")48+ nl = 049+ nl = ligne.find("stdio.h stdlib.h scotch.h")50+ if nl > 0:51+ ligne =ligne.replace("stdlib.h", "stdlib.h sys/types.h")52+ sys.stdout.write(ligne)53+ file2patch = os.path.join(self.workdir, self.content, 'bibc/utilitai/hpalloc.c')54+ self._print('FreeBSD patch: stdlib + no mallopt => modify ' + file2patch)55+ for ligne in fileinput.input(file2patch, inplace=1):56+ nl = 057+ nl = ligne.find('ir=mallopt')58+ if nl > 0:59+ ligne =ligne.replace('ir=mallopt', '/* ir=mallopt')60+ ligne =ligne.replace(');', '); */')61+ else:62+ nl = ligne.find("malloc.h")63+ if nl > 0:64+ ligne =ligne.replace("malloc.h", "stdlib.h")65+ sys.stdout.write(ligne)66+ system=SYSTEM({ 'verbose' : True, 'debug' : False },67+ **{'maxcmdlen' : 2**31, 'log' : self})68+ file2patch = os.path.join(self.workdir, self.content, 'waf.main')69+ self._print('FreeBSD patch: remove extraneous escape => modify waf.main')70+ for ligne in fileinput.input(file2patch, inplace=1):71+ nl = ligne.find("\main$")72+ if nl > 0:73+ ligne =ligne.replace("\main$", "main$")74+ sys.stdout.write(ligne)75+ for f2p in ('waf', 'waf.main', 'waf_variant', 'waf_std', 'waf_mpi', 'bibpyt/Macro/macr_ecre_calc_ops.py'):76+ file2patch = os.path.join(self.workdir, self.content, f2p)77+ self._print('FreeBSD patch: /bin/bash + GNU getopt => modify ' + file2patch)78+ for ligne in fileinput.input(file2patch, inplace=1):79+ nl = 080+ nl = ligne.find("/bin/bash")81+ if nl > 0:82+ ligne =ligne.replace("/bin/bash", " %%LOCALBASE%%/bin/bash")83+ sys.stdout.write(ligne)84+ for ligne in fileinput.input(file2patch, inplace=1):85+ nl = 086+ nl = ligne.find("getopt ")87+ if nl > 0:88+ ligne =ligne.replace("getopt ", "%%LOCALBASE%%/bin/getopt ")89+ sys.stdout.write(ligne)90+ self._print('FreeBSD patches: waf.engine and data/post_install in %s' % os.path.join(self.workdir, self.content))91+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-waf.engine')92+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-data__post_install')93+ self._print('FreeBSD patches: memory detection in bibc/utilitai/mempid.c in %s' % os.path.join(self.workdir, self.content))94+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__utilitai__mempid.c')95+ os.system('cd ' + os.path.join(self.workdir, self.content) + ' && patch -p0 < %%WRKDIR%%/post_patches/post-patch-bibc__supervis__aster_utils.c')96+ file2patch = os.path.join(self.workdir, self.content, 'waftools/mathematics.py')97+ self._print('FreeBSD patch: nproc => gnproc ' + file2patch)98+ for ligne in fileinput.input(file2patch, inplace=1):99+ nl = 0100+ nl = ligne.find("'nproc'")101+ if nl > 0:102+ ligne =ligne.replace("'nproc'", "'gnproc'")103+ sys.stdout.write(ligne)104+ # End of FreeBSD patches105106#-------------------------------------------------------------------------------107def Configure(self, **kargs):108109110