forked from wikipedia2vec/wikipedia2vec
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
98 lines (88 loc) · 3.23 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
88
89
90
91
92
93
94
95
96
97
98
# -*- coding: utf-8 -*-
# License: Apache License 2.0
import os
import platform
import sys
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext
def list_cpp_files(package_dir='wikipedia2vec'):
if sys.platform.startswith("win"):
compile_args = []
link_args = []
elif platform.system() == 'Darwin':
compile_args = ['-Wno-unused-function', '-std=c++11', '-stdlib=libc++']
link_args = ['-std=c++11', '-stdlib=libc++']
else:
compile_args = ['-Wno-unused-function', '-std=c++11']
link_args = ['-std=c++11']
ret = []
for (dir_name, _, files) in os.walk(package_dir):
for file_name in files:
(module_name, ext) = os.path.splitext(file_name)
if ext == '.cpp':
module_name = '.'.join(dir_name.split(os.sep) + [module_name])
path = os.path.join(dir_name, file_name)
ret.append((module_name, dict(
sources=[path], language='c++', extra_compile_args=compile_args,
extra_link_args=link_args
)))
return ret
# Copied from https://github.com/RaRe-Technologies/gensim/blob/master/setup.py
class custom_build_ext(build_ext):
def finalize_options(self):
build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
# https://docs.python.org/2/library/__builtin__.html#module-__builtin__
if isinstance(__builtins__, dict):
__builtins__["__NUMPY_SETUP__"] = False
else:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
setup(
name='wikipedia2vec',
version='1.0.4',
description='A tool for learning vector representations of words and entities from Wikipedia',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='Studio Ousia',
author_email='ikuya@ousia.jp',
url='http://wikipedia2vec.github.io/',
packages=find_packages(exclude=('tests*',)),
cmdclass=dict(build_ext=custom_build_ext),
ext_modules=[Extension(module_name, **kwargs) for (module_name, kwargs) in list_cpp_files()],
include_package_data=True,
entry_points={
'console_scripts': [
'wikipedia2vec=wikipedia2vec.cli:cli',
]
},
keywords=['wikipedia', 'embedding', 'wikipedia2vec'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
install_requires=[
'click',
'jieba',
'joblib',
'lmdb',
'marisa-trie',
'mwparserfromhell',
'numpy',
'scipy',
'six',
'tqdm',
],
setup_requires=['numpy'],
tests_require=['nose'],
test_suite='nose.collector',
)