forked from datalad/datalad-crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·86 lines (75 loc) · 2.79 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
#!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
from setuptools import findall
from os.path import join as opj
from os.path import sep as pathsep
from os.path import splitext
from os.path import dirname
from setup_support import BuildManPage
from setup_support import BuildRSTExamplesFromScripts
from setup_support import get_version
def findsome(subdir, extensions):
"""Find files under subdir having specified extensions
Leading directory (datalad) gets stripped
"""
return [
f.split(pathsep, 1)[1] for f in findall(opj('datalad_crawler', subdir))
if splitext(f)[-1].lstrip('.') in extensions
]
# extension version
version = get_version()
cmdclass = {
'build_manpage': BuildManPage,
'build_examples': BuildRSTExamplesFromScripts,
}
# PyPI doesn't render markdown yet. Workaround for a sane appearance
# https://github.com/pypa/pypi-legacy/issues/148#issuecomment-227757822
README = opj(dirname(__file__), 'README.md')
try:
import pypandoc
long_description = pypandoc.convert(README, 'rst')
except (ImportError, OSError) as exc:
# attempting to install pandoc via brew on OSX currently hangs and
# pypandoc imports but throws OSError demanding pandoc
print(
"WARNING: pypandoc failed to import or thrown an error while converting"
" README.md to RST: %r .md version will be used as is" % exc
)
long_description = open(README).read()
setup(
# basic project properties can be set arbitrarily
name="datalad_crawler",
author="The DataLad Team and Contributors",
author_email="[email protected]",
version=version,
description="DataLad extension package for crawling external web resources into an automated data distribution",
long_description=long_description,
packages=[pkg for pkg in find_packages('.') if pkg.startswith('datalad')],
# datalad command suite specs from here
install_requires=[
'datalad>=0.10.0.rc3',
'scrapy>=1.1.0rc3', # versioning is primarily for python3 support
],
extras_require={
'devel-docs': [
# used for converting README.md -> .rst for long_description
'pypandoc',
# Documentation
'sphinx',
'sphinx-rtd-theme',
]},
cmdclass=cmdclass,
entry_points = {
# 'datalad.extensions' is THE entrypoint inspected by the datalad API builders
'datalad.extensions': [
# the label in front of '=' is the command suite label
# the entrypoint can point to any symbol of any name, as long it is
# valid datalad interface specification (see demo in this extension)
'crawler=datalad_crawler:command_suite',
],
'datalad.tests': [
'crawler=datalad_crawler',
],
},
)