forked from danielnyga/pracmln
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
119 lines (94 loc) · 3.73 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import distutils
import os
from distutils.core import setup
import _version
import pip
pip.main(['install', 'appdirs'])
# from setuptools.command import build_py
__basedir__ = _version.__basedir__
__version__ = _version.__version__
appname = 'pracmln'
appauthor = 'danielnyga'
def iamroot():
'''Checks if this process has admin permissions.'''
try:
return os.getuid() == 0
except AttributeError:
import ctypes
return ctypes.windll.shell32.IsUserAnAdmin() != 0
def basedir(name):
return os.path.join(__basedir__, name)
with open(os.path.join(os.path.dirname(__file__), __basedir__, 'requirements.txt'), 'r') as f:
requirements = [l.strip() for l in f.readlines() if l.strip()]
def datafiles(d):
data_files = []
for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), d)):
if not files: continue
root_ = root.replace(os.getcwd() + os.path.sep, '')
data_files.append((root_, [os.path.join(root_, f) for f in files]))
return data_files
def datapath():
'''Returns the path where app data is to be installed.'''
import appdirs
if iamroot():
return appdirs.site_data_dir(appname, appauthor)
else:
return appdirs.user_data_dir(appname, appauthor)
def description():
try:
with open('README.md') as f:
return f.read()
except:
return 'Markov logic networks in Python. Please visit http://www.pracmln.org'
class myinstall(distutils.command.install.install):
def __init__(self, *args, **kwargs):
distutils.command.install.install.__init__(self, *args, **kwargs)
self.distribution.get_command_obj('install_data').install_dir = datapath()
setup(
name='pracmln',
packages=['pracmln', 'pracmln._version', 'pracmln.logic', 'pracmln.mln',
'pracmln.utils', 'pracmln.wcsp', 'pracmln.mln.grounding',
'pracmln.mln.inference', 'pracmln.mln.learning'],
package_dir={
'pracmln': basedir('pracmln'),
'pracmln._version': '_version',
},
data_files=datafiles('examples') + datafiles('3rdparty') + datafiles('libpracmln') + datafiles('etc'),
version=__version__,
description='Markov logic networks in Python',
long_description=description(),
author='Daniel Nyga',
author_email='[email protected]',
url='http://www.pracmln.org',
download_url='https://github.com/danielnyga/pracmln/archive/%s.tar.gz' % __version__,
keywords=['statistical relational learning', 'mln', 'Markov logic networks', 'reasoning', 'probcog'],
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 4 - Beta',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Artificial Intelligence ',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
],
install_requires=requirements,
entry_points={
'console_scripts': [
'mlnlearn=pracmln.mlnlearn:main',
'mlnquery=pracmln.mlnquery:main',
'libpracmln-build=pracmln.libpracmln:createcpplibs',
'pracmlntest=pracmln.test:main',
],
},
cmdclass={'install': myinstall}
)