22import sys
33import numpy
44
5+ from Cython .Build import cythonize
56from setuptools import Command , Extension , setup
67
7- # https://github.com/Unidata/cftime/issues/34
8- try :
9- from Cython .Build import cythonize
10- except ImportError :
11- cythonize = False
12-
138
149BASEDIR = os .path .abspath (os .path .dirname (__file__ ))
1510SRCDIR = os .path .join (BASEDIR ,'src' )
@@ -58,31 +53,6 @@ def run(self):
5853 print ('clean: skipping file {!r}' .format (artifact ))
5954
6055
61- def extract_version ():
62- version = None
63- with open (CYTHON_FNAME ) as fi :
64- for line in fi :
65- if (line .startswith ('__version__' )):
66- _ , version = line .split ('=' )
67- version = version .strip ()[1 :- 1 ] # Remove quotation characters.
68- break
69- return version
70-
71-
72- def load (fname ):
73- result = []
74- with open (fname , 'r' ) as fi :
75- result = [package .strip () for package in fi .readlines ()]
76- return result
77-
78-
79- def description ():
80- fname = os .path .join (BASEDIR , 'README.md' )
81- with open (fname , 'r' ) as fi :
82- result = '' .join (fi .readlines ())
83- return result
84-
85-
8656if ((FLAG_COVERAGE in sys .argv or os .environ .get ('CYTHON_COVERAGE' , None ))
8757 and cythonize ):
8858 COMPILER_DIRECTIVES = {
@@ -99,43 +69,17 @@ def description():
9969 ext_modules = []
10070else :
10171 extension = Extension ('{}._{}' .format (NAME , NAME ),
102- sources = [CYTHON_FNAME ],
72+ sources = [os . path . relpath ( CYTHON_FNAME , BASEDIR ) ],
10373 define_macros = DEFINE_MACROS ,
10474 include_dirs = [numpy .get_include (),])
105- ext_modules = [extension ]
106- if cythonize :
107- ext_modules = cythonize (extension ,
108- compiler_directives = COMPILER_DIRECTIVES ,
109- language_level = 3 )
75+
76+ ext_modules = cythonize (
77+ extension ,
78+ compiler_directives = COMPILER_DIRECTIVES ,
79+ language_level = 3 ,
80+ )
11081
11182setup (
112- name = NAME ,
113- author = 'Jeff Whitaker' ,
114- author_email = 'whitaker.jeffrey@gmail.com' ,
115- description = 'Time-handling functionality from netcdf4-python' ,
116- long_description = description (),
117- long_description_content_type = 'text/markdown' ,
11883 cmdclass = {'clean_cython' : CleanCython },
119- packages = [NAME ],
120- package_dir = {'' :'src' },
121- version = extract_version (),
12284 ext_modules = ext_modules ,
123- install_requires = load ('requirements.txt' ),
124- tests_require = load ('requirements-dev.txt' ),
125- license = 'License :: OSI Approved :: MIT License' ,
126- python_requires = ">=3.8" ,
127- classifiers = [
128- 'Development Status :: 5 - Production/Stable' ,
129- 'Operating System :: MacOS :: MacOS X' ,
130- 'Operating System :: Microsoft :: Windows' ,
131- 'Operating System :: POSIX :: Linux' ,
132- 'Programming Language :: Python' ,
133- 'Programming Language :: Python :: 3' ,
134- 'Programming Language :: Python :: 3.9' ,
135- 'Programming Language :: Python :: 3.10' ,
136- 'Programming Language :: Python :: 3.11' ,
137- 'Programming Language :: Python :: 3.12' ,
138- 'Programming Language :: Python :: 3.13' ,
139- 'Topic :: Scientific/Engineering' ,
140- 'License :: OSI Approved :: MIT License' ],
141- )
85+ )
0 commit comments