1- from distutils . core import setup
2- from distutils . extension import Extension
1+ from setuptools import setup
2+ from setuptools import Extension
33import multiprocessing
44from Cython .Build import cythonize
55import numpy
@@ -17,8 +17,10 @@ class BuildError(Exception):
1717 os .environ ["CC" ] = "gcc"
1818 print ("Using CC={} (set by setup.py)" .format (os .environ ['CC' ]))
1919
20- MODULE_DIR = os .path .dirname (os .path .abspath (__file__ ))
20+ # setup.py requires relative paths:
21+ MODULE_DIR = os .path .dirname (os .path .relpath (__file__ ))
2122SRC_DIR = os .path .join (MODULE_DIR , "fidimag" )
23+ #
2224SUNDIALS_DIR = os .path .join (SRC_DIR , "common" , "sundials" )
2325NEB_DIR = os .path .join (SRC_DIR , "common" , "neb" )
2426NEBM_DIR = os .path .join (SRC_DIR , "common" , "neb_method" )
@@ -50,9 +52,6 @@ def get_version():
5052 raise Exception ("Couldn't find __version__ in %s" % pkg_init_path )
5153
5254
53- version = get_version ()
54-
55-
5655def glob_cfiles (path , excludes , extension = "*.c" ):
5756 cfiles = []
5857 for cfile in glob .glob (os .path .join (path , extension )):
@@ -231,10 +230,11 @@ def glob_cfiles(path, excludes, extension="*.c"):
231230 )
232231]
233232
234-
233+ yellow = "\x1b [33;49m"
234+ reset = "\x1b [0m"
235235for folder in glob .glob (os .path .join (USER_DIR , '*/' )):
236236 module_name = folder .split ('/' )[- 2 ]
237- print ('Found User Module: {}' . format ( module_name ) )
237+ print (yellow + f 'Found User Module: { module_name } ' + reset )
238238 user_sources = glob .glob (folder + '/*.pyx' )
239239 if len (user_sources ) != 1 :
240240 raise BuildError ("User Modules are only allowed one Cython .pyx file" )
@@ -259,11 +259,10 @@ def glob_cfiles(path, excludes, extension="*.c"):
259259 )
260260
261261nthreads = multiprocessing .cpu_count ()
262- print ('Building with {} threads' . format ( nthreads ) )
262+ print (yellow + f 'Building with { nthreads } threads' + reset )
263263setup (
264264 name = 'fidimag' ,
265- version = version ,
266- description = 'Atomistic and finite-difference-micromagnetics code' ,
265+ version = get_version (),
267266 packages = ['fidimag' ,
268267 'fidimag.atomistic' ,
269268 'fidimag.micro' ,
0 commit comments