-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathsetup.py
99 lines (80 loc) · 2.84 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
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016-2017, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero Public License for more details.
#
# You should have received a copy of the GNU Affero Public License
# along with this program. If not, see http://www.gnu.org/licenses.
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
"""Vision tools and experiments for NuPIC.
The ImageSensor was originally part of the main NuPIC repository and
has been moved here with other image and vision components and
experiments to reduce the dependencies for NuPIC users that aren't
doing vision-related work.
"""
import os
import pkg_resources
from setuptools import setup, find_packages
import subprocess
REPO_DIR = os.path.dirname(os.path.realpath(__file__))
def _getPrereleasePackages():
skipPkgs = []
try:
nupicDist = pkg_resources.get_distribution("nupic")
if pkg_resources.parse_version(nupicDist.version).is_prerelease:
skipPkgs.append("nupic")
except pkg_resources.DistributionNotFound:
pass
try:
pkg_resources.get_distribution("htmresearch")
skipPkgs.append("htmresearch")
except pkg_resources.DistributionNotFound:
pass
return skipPkgs
def getRequirements():
skipPkgs = _getPrereleasePackages()
reqs = []
with open(os.path.join(REPO_DIR, "requirements.txt")) as requirementsFile:
for req in requirementsFile.readlines():
if req.strip().split("=")[0] not in skipPkgs:
reqs.append(req.strip())
return reqs
def getVersion():
with open(os.path.join(REPO_DIR, "VERSION")) as versionFile:
return versionFile.read().strip()
def buildMnistCpp():
cwd = os.getcwd()
workDir = os.path.join(os.path.dirname(__file__),
"src/nupic/vision/mnist/data")
os.chdir(workDir)
try:
subprocess.check_call("./build.sh", shell=True)
finally:
os.chdir(cwd)
buildMnistCpp()
setup(
name="nupic.vision",
version=getVersion(),
description=__doc__,
install_requires=getRequirements(),
package_dir={"": "src"},
packages=find_packages("src"),
namespace_packages=["nupic"],
package_data={
"nupic.vision.data": ["*.jpg", "*.xml"],
"nupic.vision.mnist.data": ["extract_mnist"],
},
zip_safe=False,
)