Skip to content

Commit 4d8342e

Browse files
author
Dilawar Singh
committed
Not yet complete because we still don't have static linking to gsl .
1 parent 18e65d5 commit 4d8342e

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

setup.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
1-
__author__ = "Dilawar Singh"
2-
__copyright__ = "Copyright 2019-, Dilawar Singh"
1+
__author__ = "Dilawar Singh"
2+
__copyright__ = "Copyright 2019-, Dilawar Singh"
33
__maintainer__ = "Dilawar Singh"
4-
__email__ = "[email protected]"
4+
__email__ = "[email protected]"
55

66
import os
77
import sys
88
import pathlib
99
from setuptools import setup, Extension
1010
from setuptools.command.build_ext import build_ext as build_ext_orig
1111

12-
# Read version from VERSION created by cmake file. This file must be present for
13-
# setup.cmake.py to work perfectly.
14-
script_dir = os.path.dirname(os.path.abspath(__file__))
12+
sdir_ = pathlib.Path().absolute()
13+
numCores_ = os.cpu_count() - 1
1514

16-
# Version file must be available. It MUST be written by cmake. Or create
17-
# it manually before running this script.
18-
with open(os.path.join(script_dir, 'python', 'VERSION'), 'r') as f:
19-
version = f.read()
20-
print('Got %s from VERSION file' % version)
15+
version = '3.1.2'
2116

2217
# importlib is available only for python3. Since we build wheels, prefer .so
2318
# extension. This way a wheel built by any python3.x will work with any python3.
@@ -30,15 +25,11 @@
3025
suffix = '.so'
3126
print('[INFO] Suffix for python SO: %s' % suffix)
3227

33-
numCores_ = os.cpu_count() - 1
34-
35-
3628
class CMakeExtension(Extension):
3729
def __init__(self, name):
3830
# don't invoke the original build_ext for this special extension
3931
super().__init__(name, sources=[])
4032

41-
4233
class build_ext(build_ext_orig):
4334
def run(self):
4435
for ext in self.extensions:
@@ -47,7 +38,7 @@ def run(self):
4738

4839
def build_cmake(self, ext):
4940
global numCores_
50-
cwd = pathlib.Path().absolute()
41+
global sdir_
5142

5243
# These dirs will be created in build_py, so if you don't have
5344
# any python sources to bundle, the dirs will be missing
@@ -66,10 +57,10 @@ def build_cmake(self, ext):
6657
print("[INFO ] Building pymoose in %s ..." % build_temp)
6758
build_args = ['--config', config, '--', '-j%d' % numCores_]
6859
os.chdir(str(build_temp))
69-
self.spawn(['cmake', str(cwd)] + cmake_args)
60+
self.spawn(['cmake', str(sdir_)] + cmake_args)
7061
if not self.dry_run:
7162
self.spawn(['cmake', '--build', '.'] + build_args)
72-
os.chdir(str(cwd))
63+
os.chdir(str(sdir_))
7364

7465

7566
with open("README.md") as f:

0 commit comments

Comments
 (0)