Skip to content

Commit

Permalink
Fix installation
Browse files Browse the repository at this point in the history
  • Loading branch information
alfred82santa committed Nov 7, 2016
1 parent b8d2f0e commit 980ba09
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ Features
Changelog
---------

Version 0.9.1
-------------

- Fix installation.

Version 0.9.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion dirty_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
from .models import *
from .fields import *

__version__ = '0.9.0'
__version__ = '0.9.1'
30 changes: 28 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
import ast
import sys

import os
import re
from setuptools import setup

import dirty_models
path = os.path.join(os.path.dirname(__file__), 'dirty_models', '__init__.py')

with open(path, 'r') as file:
t = compile(file.read(), path, 'exec', ast.PyCF_ONLY_AST)
for node in (n for n in t.body if isinstance(n, ast.Assign)):
if len(node.targets) != 1:
continue

name = node.targets[0]
if not isinstance(name, ast.Name) or \
name.id not in ('__version__', '__version_info__', 'VERSION'):
continue

v = node.value
if isinstance(v, ast.Str):
version = v.s
break
if isinstance(v, ast.Tuple):
r = []
for e in v.elts:
if isinstance(e, ast.Str):
r.append(e.s)
elif isinstance(e, ast.Num):
r.append(str(e.n))
version = '.'.join(r)
break

install_requires = ['python-dateutil']

Expand All @@ -22,7 +48,7 @@
name='dirty-models',
url='https://github.com/alfred82santa/dirty-models',
author='alfred82santa',
version=dirty_models.__version__,
version=version,
author_email='alfred82santa@gmail.com',
license='BSD',
classifiers=[
Expand Down

0 comments on commit 980ba09

Please sign in to comment.