- # When environnement variable is unavailable assume the package was
- # properly installed i.e. the layout is such that the directory containing
- # the dictionaries is BELOW (the root is at the top) the current file.
- # Note: when importing this __init__ file the pathes are relative to the
- # invocation directory. In order to get them relative to the package
- # (or more simply to this file) we rely on the __path__ variable.
- InstallModePath = os.path.join(__path__[0], "Dicts/")
- if os.path.isfile(os.path.join(InstallModePath, "dicomV3.dic")):
- os.environ["GDCM_DICT_PATH"] = InstallModePath
- PreInstallModePath = None
- else:
- # When both environnement variable and proper package installation
- # strategy fail we eventually consider the pre-installation mode
- # i.e. when developpers are toying in a CVS tree. In this case
- # the layout is such that the directory containing the dictionaries is
- # ABOVE (the root is at the top) the current directory.
- PreInstallModePath = os.path.join(__path__[0], "..", "Dicts/")
- if os.path.isfile(os.path.join(PreInstallModePath, "dicomV3.dic")):
- os.environ["GDCM_DICT_PATH"] = PreInstallModePath
- InstallModePath = None
- else:
- print "Unfound gdcm dictionaries path"
- sys.exit(1)
-
-### Set up the path to the data images (for the test suite and the demo
-# examples). As for GDCM_DICT_PATH we offer both proper python package
-# installation scheme and the pre-install mode (see above).
-InstallModePath = os.path.join(__path__[0], "Data")
-if os.path.isfile(os.path.join(InstallModePath, "test.acr")):
- GDCM_DATA_PATH = InstallModePath
-else:
- PreInstallModePath = os.path.join(__path__[0], "..", "Data")
- if os.path.isfile(os.path.join(PreInstallModePath, "test.acr")):
- GDCM_DATA_PATH = PreInstallModePath
- else:
- print "Unfound data path"