|
5 | 5 | # SPDX-License-Identifier: BSD-3-Clause |
6 | 6 | # <<END-copyright>> |
7 | 7 |
|
8 | | -import os, sys, glob, shutil, pathlib |
| 8 | +import os, sys, glob, shutil |
9 | 9 | import setuptools |
10 | 10 | from setuptools.command.install import install |
11 | 11 | from setuptools.command.build_ext import build_ext |
|
26 | 26 | class CustomInstall(install): |
27 | 27 | """Custom handler for the 'install' command.""" |
28 | 28 | def run(self): |
29 | | - print("In CustomInstall run:") |
30 | 29 | # copy C executables Merced/bin/merced and fudge/processing/deterministic/upscatter/bin/calcUpscatterKernel to Python environment bin folder |
31 | 30 | workingFolder = os.getcwd() |
32 | 31 | binFolder = os.path.join(sys.prefix, 'bin') |
33 | 32 | os.chdir('Merced') |
34 | 33 | subprocess.check_call('make -j', shell=True) |
35 | | - |
36 | | - sbd = pathlib.Path("Src") |
37 | | - print("Contents of Src:", list(sbd.iterdir())) |
38 | | - bbd = pathlib.Path("bin") |
39 | | - print("Contents of bin:", list(bbd.iterdir())) |
40 | | - |
41 | | - print("After building, copy to", binFolder) |
42 | | - shutil.copy(pathlib.Path("bin") / "merced", binFolder) |
| 34 | + executable = "bin/merced" |
| 35 | + if sys.platform.startswith('win'): |
| 36 | + executable = "bin/merced.exe" |
| 37 | + shutil.copy(executable, binFolder) |
43 | 38 | os.chdir(workingFolder) |
44 | 39 |
|
45 | 40 | os.chdir('fudge/processing/deterministic/upscatter') |
46 | 41 | subprocess.check_call('make -j', shell=True) |
47 | | - shutil.copy(pathlib.Path("bin") / "calcUpscatterKernel", binFolder) |
| 42 | + executable = "bin/calcUpscatterKernel" |
| 43 | + if sys.platform.startswith('win'): |
| 44 | + executable = "bin/calcUpscatterKernel.exe" |
| 45 | + shutil.copy(executable, binFolder) |
48 | 46 | os.chdir(workingFolder) |
49 | 47 |
|
50 | 48 | super().run() |
|
0 commit comments