File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 1- __version__ = '2.3.0'
2-
31"""
42PySAL: Python Spatial Analysis Library
53======================================
64
7- Contents
8- --------
9- pysal imports federation information
5+ A federation of packages for spatial data science.
106
117
128Layers and Subpackages
5753
5854"""
5955from .base import memberships , federation_hierarchy , versions
56+ __version__ = '2.3.0'
Original file line number Diff line number Diff line change 11# coding: utf-8
2-
2+ import codecs
3+ import os .path
34from setuptools import setup , find_packages
45
56from distutils .command .build_py import build_py
910with open ('README.md' ) as file :
1011 long_description = file .read ()
1112
12- with open ('pysal/__init__.py' , 'r' ) as f :
13- exec (f .readline ())
1413
14+ def read (rel_path ):
15+ here = os .path .abspath (os .path .dirname (__file__ ))
16+ with codecs .open (os .path .join (here , rel_path ), 'r' ) as fp :
17+ return fp .read ()
18+
19+ def get_version (rel_path ):
20+ for line in read (rel_path ).splitlines ():
21+ if line .startswith ('__version__' ):
22+ delim = '"' if '"' in line else "'"
23+ return line .split (delim )[1 ]
24+ else :
25+ raise RuntimeError ("Unable to find version string." )
1526
1627print (find_packages ())
1728# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
@@ -44,7 +55,7 @@ def setup_package():
4455 extras_reqs = reqs
4556 setup (
4657 name = 'pysal' ,
47- version = __version__ ,
58+ version = get_version ( 'pysal/__init__.py' ) ,
4859 description = "A library of spatial analysis functions." ,
4960 long_description = long_description ,
5061 long_description_content_type = "text/markdown" ,
You can’t perform that action at this time.
0 commit comments