Skip to content

Commit 94b7eed

Browse files
authored
Merge pull request pysal#1191 from sjsrey/2.3.0
2.3.0
2 parents d1a1f7d + 883717f commit 94b7eed

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

pysal/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
__version__ = '2.3.0'
2-
31
"""
42
PySAL: 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
128
Layers and Subpackages
@@ -57,3 +53,4 @@
5753
5854
"""
5955
from .base import memberships, federation_hierarchy, versions
56+
__version__ = '2.3.0'

setup.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# coding: utf-8
2-
2+
import codecs
3+
import os.path
34
from setuptools import setup, find_packages
45

56
from distutils.command.build_py import build_py
@@ -9,9 +10,19 @@
910
with 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

1627
print(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",

0 commit comments

Comments
 (0)