Lines Matching refs:os

3 import os, re, shutil, sys
6 if 'PETSC_DIR' in os.environ:
7 PETSC_DIR = os.environ['PETSC_DIR']
9 fd = open(os.path.join('lib','petsc','conf','petscvariables'))
15 if 'PETSC_ARCH' in os.environ:
16 PETSC_ARCH = os.environ['PETSC_ARCH']
18 fd = open(os.path.join('lib','petsc','conf','petscvariables'))
23 sys.path.insert(0, os.path.join(PETSC_DIR, 'config'))
24 sys.path.insert(0, os.path.join(PETSC_DIR, 'config', 'BuildSystem'))
37 argDB.saveFilename = os.path.join(PETSC_DIR, PETSC_ARCH, 'lib','petsc','conf', 'RDict.db')
67 self.installDir = os.path.abspath(os.path.expanduser(self.framework.argDB['prefix']))
68 self.destDir = os.path.abspath(self.argDB['destDir']+self.installDir)
70 self.archDir = os.path.join(self.rootDir, self.arch)
71 self.rootIncludeDir = os.path.join(self.rootDir, 'include')
72 self.archIncludeDir = os.path.join(self.rootDir, self.arch, 'include')
73 self.rootConfDir = os.path.join(self.rootDir, 'lib','petsc','conf')
74 self.archConfDir = os.path.join(self.rootDir, self.arch, 'lib','petsc','conf')
75 self.rootBinDir = os.path.join(self.rootDir, 'lib','petsc','bin')
76 self.archBinDir = os.path.join(self.rootDir, self.arch, 'bin')
77 self.archLibDir = os.path.join(self.rootDir, self.arch, 'lib')
78 self.destIncludeDir = os.path.join(self.destDir, 'include')
79 self.destConfDir = os.path.join(self.destDir, 'lib','petsc','conf')
80 self.destLibDir = os.path.join(self.destDir, 'lib')
81 self.destBinDir = os.path.join(self.destDir, 'lib','petsc','bin')
82 self.installIncludeDir = os.path.join(self.installDir, 'include')
83 self.installLibDir = os.path.join(self.installDir, 'lib')
84 self.installBinDir = os.path.join(self.installDir, 'lib','petsc','bin')
85 self.rootShareDir = os.path.join(self.rootDir, 'share')
86 self.destShareDir = os.path.join(self.destDir, 'share')
87 self.rootSrcDir = os.path.join(self.rootDir, 'src')
103 if os.path.exists(self.destDir):
104 if os.path.samefile(self.destDir, self.rootDir):
109 if os.path.samefile(self.destDir, os.path.join(self.rootDir,self.arch)):
114 if not os.path.isdir(os.path.realpath(self.destDir)):
119 if not os.access(self.destDir, os.W_OK):
128 os.environ.get(prefix + '_BUILD_BACKEND')
131 self.relocate_py_env = os.environ.get('CIBUILDWHEEL', '0') == '1'
137 if not os.path.exists(dst):
138 os.makedirs(dst)
139 elif not os.path.isdir(dst):
142 dstname = os.path.join(dst, os.path.basename(src))
144 if symlinks and os.path.islink(srcname):
145 linkto = os.readlink(srcname)
146 os.symlink(linkto, dstname)
150 except (IOError, os.error) as why:
185 if not os.path.isdir(dst):
189 newConfigDir=os.path.join(dst,'config') # Am not renaming at present
190 if not os.path.isdir(newConfigDir): os.mkdir(newConfigDir)
194 self.copies.extend(self.copyfile(os.path.join('config',tf),newConfigDir))
200 for root, dirs, files in os.walk(src, topdown=False):
201 if os.path.basename(root) not in ("tests", "tutorials"): continue
219 names = os.listdir(src)
220 if not os.path.exists(dst):
221 os.makedirs(dst)
222 elif not os.path.isdir(dst):
228 srcname = os.path.join(src, name)
229 dstname = os.path.join(dst, name)
231 if symlinks and os.path.islink(srcname):
232 linkto = os.readlink(srcname)
233 os.symlink(linkto, dstname)
234 elif os.path.isdir(srcname) and recurse and not os.path.basename(srcname) in exclude:
236 …elif os.path.isfile(srcname) and not os.path.basename(srcname) in exclude and os.path.splitext(nam…
237 if os.path.islink(srcname):
244 except (IOError, os.error) as why:
254 except (IOError, os.error) as why:
298 self.fixConfFile(os.path.join(self.destConfDir,file))
319 if os.path.isdir(pathname):
321 elif os.path.exists(pathname):
322 os.remove(pathname)
326 pylibdir = os.path.join(pydir, 'lib')
329 petscdir = os.path.join(pysitedir, 'petsc')
330 petsclibdir = os.path.join(petscdir, 'lib')
348 pydir_from_petsc = os.path.relpath(pydir, petscdir)
349 contents = contents.replace(pydir, os.path.join('${PETSC_DIR}', pydir_from_petsc))
359 return glob.glob(os.path.join(dirname, *patterns))
362 libdir = os.path.join(self.installDir, 'lib')
366 if not os.path.islink(lib)
371 rpath = rpath.split(os.path.pathsep)
385 libdir_from_petsc = os.path.relpath(libdir, petsclibdir)
386 rpath.insert(0, os.path.join('$ORIGIN',libdir_from_petsc))
387 pylibdir_from_petsc = os.path.relpath(pylibdir, petsclibdir)
388 rpath.insert(0, os.path.join('$ORIGIN',pylibdir_from_petsc))
390 rpath = os.path.pathsep.join(rpath)
393 basename = os.path.basename(shlib)
398 if os.path.islink(symlink):
399 os.unlink(symlink)
400 curdir = os.getcwd()
402 os.chdir(os.path.dirname(shlib))
404 os.rename(basename, soname)
409 os.chdir(curdir)
423 if not os.path.islink(lib)
430 install_name = '@rpath/' + os.path.basename(install_name)
438 if os.path.dirname(dep) in (libdir,):
439 newid = '@rpath/' + os.path.basename(dep)
442 basename = os.path.basename(dylib)
443 libname, ext = os.path.splitext(basename)
446 dyname = os.path.basename(install_name)
448 if os.path.islink(symlink):
449 os.unlink(symlink)
450 curdir = os.getcwd()
452 os.chdir(os.path.dirname(dylib))
454 os.rename(basename, dyname)
456 os.symlink(dyname, liblink)
458 os.chdir(curdir)
463 uninstallscript = os.path.join(self.destConfDir, 'uninstall.py')
483 os.chmod(uninstallscript,0o744)
518 examplesdir=os.path.join(self.destShareDir,'petsc','examples')
519 if os.path.exists(examplesdir):
521 os.mkdir(examplesdir)
522 os.mkdir(os.path.join(examplesdir,'src'))
525 self.copyExamples(self.rootSrcDir,os.path.join(examplesdir,'src'))
526 self.fixExamplesMakefile(os.path.join(examplesdir,'gmakefile.test'))
532 if os.path.islink(src):
533 linkto = os.readlink(src)
535 os.remove(dst) # In case it already exists
538 os.symlink(linkto, dst)
541 …if self.setCompilers.getCompiler().find('win32fe') < 0 and os.path.splitext(dst)[1] == '.'+self.ar…
544 …if os.path.splitext(dst)[1] == '.dylib' and shutil.which('otool') and shutil.which('install_name_t…
547 installName = oldname.replace(os.path.realpath(self.archDir), self.installDir)
555 …self.copies.extend(self.copytree(os.path.join(self.archLibDir,'pkgconfig'), os.path.join(self.dest…
590 if not os.path.exists(self.destDir):
592 os.makedirs(self.destDir)
631 if os.path.exists(delfile) and (os.stat(delfile).st_uid==0):
632 os.remove(delfile)