#!/usr/bin/env python3
#
#

import sys, site, os

sys.path.insert(0, os.getcwd())

from oolib import Base, __version__

target = "dist" + os.sep + "oolib-%s.tar.gz" %  __version__
installdir = 'run'

if not os.path.isdir(installdir):
    os.mkdir(installdir)

print("setting PYTHONPATH to %s" % installdir)
os.environ['PYTHONPATH'] = installdir

sys.path.insert(0, installdir)
sys.path.insert(0, installdir + os.sep + 'bin')

try:
    from setuptools.command.easy_install import main
    import pkg_resources
except ImportError as ex: print("setuptools is needed to use nest: %s" % str(ex)) ;  os._exit(1)
runstring = '--install-dir %s -a -U %s' % (installdir, target)
main(runstring.split())
os.chdir(installdir)
print('done')
