-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency from $NUPIC environment variable. Fixes numenta/nupic#1815, numenta/nupic#1947 #1970
Remove dependency from $NUPIC environment variable. Fixes numenta/nupic#1815, numenta/nupic#1947 #1970
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,7 @@ | |
# http://numenta.org/licenses/ | ||
# ---------------------------------------------------------------------- | ||
__version__ = "0.3.0.dev0" | ||
|
||
import os | ||
NUPIC_ROOT = os.environ.get('NUPIC', os.path.dirname(os.path.realpath(__file__))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried get the absolute path of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 great idea!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi David, my change will consider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's wait what Matthew thinks ;) keeping it might be better for sidemodules or community projects that may rely on it. There are a lot and Matthew probably has the best overview. How about just a try-except implementation? -------- Original message -------- From: Pascal Ehlert notifications@github.com Date:03/30/2015 15:52 (GMT+01:00) To: numenta/nupic nupic@noreply.github.com Cc: Pascal Weinberger passiweinberger@gmail.com
— There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You guys are right. We could keep $NUPIC as extra (but not required) variable. So this script should get the value of $NUPIC and in case of it is not found, get the absolute path of this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure whether this is clear, but that's what it does right now. So There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I'll stay with that solution? |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
from pkg_resources import resource_filename | ||
import unittest2 as unittest | ||
|
||
from nupic import NUPIC_ROOT | ||
from nupic.data import dictutils | ||
from nupic.database.ClientJobsDAO import ClientJobsDAO | ||
from nupic.support import aggregationDivide | ||
|
@@ -118,7 +119,7 @@ def setUp(self): | |
global g_myEnv | ||
if not g_myEnv: | ||
# Setup environment | ||
params = type('obj', (object,), {'installDir' : os.environ['NUPIC']}) | ||
params = type('obj', (object,), {'installDir' : NUPIC_ROOT}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
g_myEnv = MyTestEnvironment(params) | ||
|
||
|
||
|
@@ -1947,7 +1948,7 @@ def _getTestList(): | |
# Our custom options (that don't get passed to unittest): | ||
customOptions = ['--installDir', '--verbosity', '--logLevel'] | ||
parser.add_option( | ||
"--installDir", dest="installDir", default=os.environ['NUPIC'], | ||
"--installDir", dest="installDir", default=NUPIC_ROOT, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, change in the location |
||
help="Path to the NTA install directory [default: %default].") | ||
|
||
parser.add_option("--verbosity", default=0, type="int", | ||
|
@@ -1961,7 +1962,7 @@ def _getTestList(): | |
|
||
# The following are put here to document what is accepted by the unittest | ||
# module - we don't actually use them in this code bas. | ||
parser.add_option("--verbose", dest="verbose", default=os.environ['NUPIC'], | ||
parser.add_option("--verbose", dest="verbose", default=NUPIC_ROOT, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, change in the location |
||
help="Verbose output") | ||
parser.add_option("--quiet", dest="quiet", default=None, | ||
help="Minimal output") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import sys | ||
import unittest2 as unittest | ||
|
||
from nupic import NUPIC_ROOT | ||
from nupic.frameworks.opf.opfhelpers import ( | ||
loadExperimentDescriptionScriptFromDir, | ||
getExperimentDescriptionInterfaceFromModule | ||
|
@@ -47,9 +48,7 @@ class MyTestEnvironment(object): | |
|
||
def __init__(self): | ||
|
||
nupicDir = os.environ['NUPIC'] | ||
|
||
examplesDir = os.path.join(nupicDir, "examples") | ||
examplesDir = os.path.join(NUPIC_ROOT, "examples") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, change in the location |
||
|
||
_debugOut("examplesDir=<%s>" % (examplesDir,)) | ||
|
||
|
@@ -58,7 +57,7 @@ def __init__(self): | |
|
||
# This is where we find OPF binaries (e.g., run_opf_experiment.py, etc.) | ||
# In the autobuild, it is a read-only directory | ||
self.__opfBinDir = os.path.join(nupicDir, "scripts") | ||
self.__opfBinDir = os.path.join(NUPIC_ROOT, "scripts") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, change in the location |
||
assert os.path.exists(self.__opfBinDir), \ | ||
"%s is not present in filesystem" % self.__opfBinDir | ||
_debugOut("self.__opfBinDir=<%s>" % self.__opfBinDir) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples
is in the root of the repo which is a level aboveNUPIC_ROOT
. And pkg_resources would probably be better here but up to you