forked from jpsca/sqla-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
92 lines (73 loc) · 2.8 KB
/
setup.py
File metadata and controls
92 lines (73 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# coding=utf-8
b'This library requires Python 2.6, 2.7, 3.3, 3.4 or pypy'
import io
import os
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
PACKAGE = 'sqlalchemy_wrapper'
def get_path(*args):
return os.path.join(os.path.dirname(__file__), *args)
def read_from(filepath):
with io.open(filepath, 'rt', encoding='utf8') as f:
return f.read()
def get_version():
data = read_from(get_path(PACKAGE, '__init__.py'))
version = re.search(r"__version__\s*=\s*u?'([^']+)'", data).group(1)
return str(version)
def find_package_data(root, include_files=('.gitignore', )):
files = []
src_root = get_path(root).rstrip('/') + '/'
for dirpath, subdirs, filenames in os.walk(src_root):
path, dirname = os.path.split(dirpath)
if dirname.startswith(('.', '_')):
continue
dirpath = dirpath.replace(src_root, '')
for filename in filenames:
is_valid_filename = not (
filename.startswith('.') or
filename.endswith('.pyc')
)
include_it_anyway = filename in include_files
if is_valid_filename or include_it_anyway:
files.append(os.path.join(dirpath, filename))
return files
def find_packages_data(*roots):
return dict([(root, find_package_data(root)) for root in roots])
def get_description():
data = read_from(get_path(PACKAGE, '__init__.py'))
desc = re.search('"""(.+)"""', data, re.DOTALL).group(1)
return desc.strip()
def get_requirements(filename='requirements.txt'):
data = read_from(get_path(filename))
lines = map(lambda s: s.strip(), data.splitlines())
return [l for l in lines if l and not l.startswith('#')]
setup(
name='SQLAlchemy-Wrapper',
version=get_version(),
author='Juan-Pablo Scaletti',
author_email='juanpablo@lucumalabs.com',
packages=[PACKAGE],
package_data=find_packages_data(PACKAGE, 'tests'),
zip_safe=False,
url='http://github.com/jpscaletti/sqlalchemy-wrapper',
license='BSD (see LICENSE)',
description='A framework-independent wrapper for SQLAlchemy that makes it really easy to use',
long_description=get_description(),
install_requires=get_requirements(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: PyPy',
]
)