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- 4+ 55
66import os
77import sys
88import pathlib
99from setuptools import setup , Extension
1010from 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.
3025 suffix = '.so'
3126print ('[INFO] Suffix for python SO: %s' % suffix )
3227
33- numCores_ = os .cpu_count () - 1
34-
35-
3628class 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-
4233class 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
7566with open ("README.md" ) as f :
0 commit comments