Skip to content

Commit

Permalink
Removed py_utilities dependency from setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankanno committed Jun 1, 2014
1 parent f0c1f52 commit 5e6d3b8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
1 change: 1 addition & 0 deletions py_utilities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
__title__ = 'py_utilities'
__version__ = '{0.major}.{0.minor}.{0.patch}'.format(VERSION)
__author__ = 'Ryan Kanno'
__email__ = 'ryankanno@localkinegrinds.com'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013 Ryan Kanno'

Expand Down
52 changes: 42 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
# -*- coding: utf-8 -*-

import os
import re

try:
from setuptools import setup
except ImportError:
from distutils.core import setup

import py_utilities

setup_dir = os.path.dirname(os.path.realpath(__file__))

packages = [
'py_utilities',
'py_utilities.collections',
Expand All @@ -29,13 +26,47 @@
'py_utilities.ui',
]

here = os.path.dirname(os.path.realpath(__file__))

# Metadata

meta = {}
re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
re_version = re.compile(r'VERSION\s*=.*?\((.*?)\)')
strip_quotes = lambda s: s.strip("\"'")


def add_version(match):
return {'VERSION': match.group(1).replace(" ", "").replace(",", ".")}


def add_meta(match):
attr_name, attr_value = m.groups()
return {attr_name: strip_quotes(attr_value)}


patterns = {
re_meta: add_meta,
re_version: add_version
}


with open(os.path.join(here, 'py_utilities/__init__.py'), 'r') as f:
for line in f:
for pattern, handler in patterns.items():
m = pattern.match(line.strip())
if m:
meta.update(handler(m))

# Requires

requires = ['pytz', 'importlib', 'scrypt', 'xlrd', 'ordereddict']
tests_require = ['flake8', 'mock', 'nose', 'nosexcover']

with open(os.path.join(setup_dir, 'README.rst')) as f:
with open(os.path.join(here, 'README.rst')) as f:
readme = f.read()

with open(os.path.join(setup_dir, 'CHANGES')) as f:
with open(os.path.join(here, 'CHANGES')) as f:
changes = f.read()

classifiers = [
Expand All @@ -48,19 +79,20 @@

setup(
name='py-utilities',
version=py_utilities.__version__,
version=meta['VERSION'],
description='Collection of python utilities',
long_description=readme + '\n\n' + changes,
author='Ryan Kanno',
author_email='ryankanno@localkinegrinds.com',
author=meta['author'],
author_email=meta['email'],
url="https://github.com/ryankanno/py-utilities",
packages=packages,
package_data={'': ['LICENSE']},
package_dir={'py_utilities': 'py_utilities'},
install_requires=requires,
license='MIT',
license=meta['license'],
tests_require=tests_require,
classifiers=classifiers,
)


# vim: filetype=python

0 comments on commit 5e6d3b8

Please sign in to comment.