File: install_fortran_mod.py

package info (click to toggle)
xraylib 4.0.0%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 46,936 kB
  • sloc: ansic: 16,103; f90: 8,746; java: 6,766; python: 1,497; cpp: 1,305; pascal: 1,139; makefile: 809; ruby: 622; php: 594; perl: 573; cs: 193; sh: 125
file content (39 lines) | stat: -rwxr-xr-x 1,194 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3

# taken from https://thispointer.com/python-how-to-get-list-of-files-in-directory-and-sub-directories/

import os
import sys
import shutil

'''
    For the given path, get the List of all files in the directory tree 
'''
def getListOfFiles(dirName):
    # create a list of file and sub directories 
    # names in the given directory 
    listOfFile = os.listdir(dirName)
    allFiles = list()
    # Iterate over all the entries
    for entry in listOfFile:
        # Create full path
        fullPath = os.path.join(dirName, entry)
        # If entry is a directory then get the list of files in this directory 
        if os.path.isdir(fullPath):
            allFiles = allFiles + getListOfFiles(fullPath)
        else:
            allFiles.append(fullPath)
                
    return allFiles

build_root = os.environ['MESON_BUILD_ROOT']
install_destdir_prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
files = getListOfFiles(build_root)
files = list(filter(lambda file: os.path.basename(file) == 'xraylib.mod', files))
if not files:
    sys.exit('xraylib.mod was not found!')

shutil.copy(files[0], os.path.join(install_destdir_prefix, 'include', 'xraylib'))