diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..99e2a4e --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.coverage +*.pyc +build +dist +doc/_build +geopandas.egg-info +geopandas/version.py diff --git a/geopandas/__init__.py b/geopandas/__init__.py index 7985648..c283648 100644 --- a/geopandas/__init__.py +++ b/geopandas/__init__.py @@ -1,2 +1,3 @@ +from geopandas.version import version as __version__ from geoseries import GeoSeries from geodataframe import GeoDataFrame diff --git a/setup.py b/setup.py index f94aab9..51736f3 100644 --- a/setup.py +++ b/setup.py @@ -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',