-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
63 lines (50 loc) · 1.75 KB
/
setup.py
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
"""Setup script"""
from glob import glob
import os
from setuptools import (
find_packages,
setup,
)
# =============================================================================
# Globals
# =============================================================================
"""Location of the README file"""
README = 'README.md'
"""Github username"""
USERNAME = 'fennerm'
"""Package name"""
NAME = 'fmbiopy'
# =============================================================================
# Helpers
# =============================================================================
def long_description(readme=README):
"""Extract the long description from the README"""
try:
from pypandoc import convert
long_description = convert(str(readme), 'md', 'rst')
except (ImportError, IOError, OSError):
with open(readme, 'r') as f:
long_description = f.read()
return long_description
def url(name=NAME, username=USERNAME):
"""Generate the package url from the package name"""
return '/'.join(['http://github.com', username, name])
def list_scripts():
"""Get the names of the scripts in the bin directory"""
scripts = glob("bin/*")
scripts = ["bin/" + script for script in scripts]
scripts = [f for f in scripts if os.path.isfile(f)]
scripts = [f for f in scripts if '__init__' not in f]
scripts = [f for f in scripts if not f.endswith('.pyc')]
return scripts
setup(name=NAME,
version='0.0.1',
description=long_description()[0],
long_description=long_description(),
url=url(),
author='Fenner Macrae',
author_email='[email protected]',
license='MIT',
packages=find_packages(exclude=["*test*"]),
scripts=list_scripts()
)