1. code_aster
  2. codeaster-src

Commits

Mathieu Courtois  committed d4f80d0

[BB0006] clean the python files from a previous install (#21169)

  • Participants
  • Parent commits 07cb388
  • Branches v11

Comments (0)

Files changed (2)

File bibpyt/wscript

View file
 # coding=utf-8
 
-import os.path as osp
-import shutil
 from pprint import pformat
 
 def build(self):
     get_srcs = self.path.get_src().ant_glob
     env = self.all_envs[self.variant]
-    #if self.cmd.startswith('install'):
-        #try:
-            #shutil.rmtree(env.PYTHONDIR)
-        #except OSError:
-            #pass
 
     self(
         features = 'py',

File wscript

View file
         return ori_get_usage() + os.linesep.join((
         '',
         'Environment variables:',
-        '  INCLUDES       : space separated list of directories extending the include'
-        ' path',
         '  CC             : C compiler',
         '  FC             : Fortran compiler',
         '  CXX            : C++ compiler',
     if not self.variant:
         self.fatal('Call "waf build_debug" or "waf build_release", and read ' \
                    'the comments in the wscript file!')
+    if self.cmd.startswith('install'):
+        # because we can't know which files are obsolete `rm *.py{,c,o}`
+        instdir = self.root.find_node(self.env.ASTERLIBDIR)
+        if instdir and instdir.abspath().startswith(osp.abspath(self.env['PREFIX'])):
+            files = instdir.ant_glob('**/*.py')
+            files.extend(instdir.ant_glob('**/*.pyc'))
+            files.extend(instdir.ant_glob('**/*.pyo'))
+            for i in [i.abspath() for i in files]:
+                os.remove(i)
 
     self.recurse('bibfor')
     self.recurse('bibc')
-
     self.recurse('bibpyt')
     self.recurse('i18n')
     lsub = ['materiau', 'datg', 'catapy', 'catalo']