-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
87 lines (71 loc) · 2.41 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# -*- coding: utf-8 -*-
"""
ConsoleMD parses markdown using CommonMark-py (implementation of the
CommonMarkdown spec) and then fully renders it to the console in true color.
"""
import os
from setuptools import setup
base_dir = os.path.dirname(os.path.abspath(__file__))
pkg_name = 'consolemd'
# adapted from: http://code.activestate.com/recipes/82234-importing-a-dynamically-generated-module/
def pseudo_import( pkg_name ):
"""
return a new module that contains the variables of pkg_name.__init__
"""
init = os.path.join( pkg_name, '__init__.py' )
# remove imports and 'from foo import'
lines = open(init,'r').readlines()
lines = filter( lambda l: not l.startswith('from'), lines)
lines = filter( lambda l: not l.startswith('import'), lines)
code = '\n'.join(lines)
import imp
module = imp.new_module(pkg_name)
exec(code, module.__dict__)
return module
# trying to make this setup.py as generic as possible
module = pseudo_import(pkg_name)
setup(
name=pkg_name,
packages=[pkg_name],
install_requires=[
'click',
'pygments',
'setproctitle',
'commonmark',
],
extras_require = {
'test': [
'pytest>=4.3.1',
'pytest-runner>=4.4',
'pytest-console-scripts>=0.1.9',
],
},
entry_points='''
[console_scripts]
consolemd=consolemd.cli:cli
''',
# metadata for upload to PyPI
description = "ConsoleMD renders markdown to the console",
long_description = __doc__,
version = module.__version__,
author = module.__author__,
author_email = module.__author_email__,
license = module.__license__,
keywords = "markdown console terminal".split(),
url = module.__url__,
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Documentation",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Terminals",
"Topic :: Text Processing :: Markup",
"Topic :: Utilities",
],
data_files = [],
)