Better version handling, including __version__ and git hash for dev releases.

This commit is contained in:
Kelsey Jordahl
2013-08-19 20:43:20 -04:00
parent 553da148bc
commit 3ebb433818
3 changed files with 65 additions and 1 deletions
+7
View File
@@ -0,0 +1,7 @@
.coverage
*.pyc
build
dist
doc/_build
geopandas.egg-info
geopandas/version.py
+1
View File
@@ -1,2 +1,3 @@
from geopandas.version import version as __version__
from geoseries import GeoSeries
from geodataframe import GeoDataFrame
+57 -1
View File
@@ -1,3 +1,12 @@
#!/usr/bin/env/python
"""Installation script
Version handling borrowed from pandas project.
"""
import os
import warnings
try:
from setuptools import setup
except ImportError:
@@ -17,8 +26,55 @@ such as PostGIS.
.. _shapely: http://toblerity.github.io/shapely
"""
MAJOR = 0
MINOR = 1
MICRO = 0
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
QUALIFIER = ''
FULLVERSION = VERSION
if not ISRELEASED:
FULLVERSION += '.dev'
try:
import subprocess
try:
pipe = subprocess.Popen(["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE).stdout
except OSError:
# msysgit compatibility
pipe = subprocess.Popen(
["git.cmd", "describe", "HEAD"],
stdout=subprocess.PIPE).stdout
rev = pipe.read().strip()
FULLVERSION = '%d.%d.%d.dev-%s' % (MAJOR, MINOR, MICRO, rev)
except:
warnings.warn("WARNING: Couldn't get git revision")
else:
FULLVERSION += QUALIFIER
def write_version_py(filename=None):
cnt = """\
version = '%s'
short_version = '%s'
"""
if not filename:
filename = os.path.join(
os.path.dirname(__file__), 'geopandas', 'version.py')
a = open(filename, 'w')
try:
a.write(cnt % (FULLVERSION, VERSION))
finally:
a.close()
write_version_py()
setup(name='geopandas',
version='0.1dev',
version=FULLVERSION,
description='Geographic pandas extensions',
license='BSD',
author='Kelsey Jordahl',