aboutsummaryrefslogtreecommitdiff
path: root/ips/env.py
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunk@stsci.edu>2013-04-22 11:05:20 -0400
committerJoseph Hunkeler <jhunk@stsci.edu>2013-04-22 11:05:20 -0400
commitfddf6d1688f90be761536b1a86f8d6881d6ea816 (patch)
treea10c7404b0d2c0c6a3c5f029cf40211d269370f3 /ips/env.py
parentbe635e65fa948cf2fe7aca341b3dc6c2479e0d15 (diff)
downloadipsutils-fddf6d1688f90be761536b1a86f8d6881d6ea816.tar.gz
Add GNU GPLv3 licensing
Diffstat (limited to 'ips/env.py')
-rw-r--r--ips/env.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/ips/env.py b/ips/env.py
index b7f611a..cd5695d 100644
--- a/ips/env.py
+++ b/ips/env.py
@@ -1,3 +1,18 @@
+# This file is part of ipsutils.
+
+# ipsutils is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# ipsutils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with ipsutils. If not, see <http://www.gnu.org/licenses/>.
+
import os
import sys
from . import config
@@ -6,12 +21,15 @@ from . import config
class Environment(config.Config):
def __init__(self, ipsfile):
super(Environment, self).__init__(ipsfile)
+
+ # Platform specific ipsbuild directory assignment
if sys.platform == 'linux2' \
or sys.platform == 'sunos5':
self.__basepath = os.path.join(os.environ['HOME'], 'ipsbuild')
else:
self.__basepath = os.path.join(os.environ['USERPROFILE'], 'ipsbuild')
-
+
+ # Dictionary of top-level directories
self.env = {
'IPSBUILD': self.pathgen(''),
'BUILDROOT': self.pathgen('BUILDROOT'),
@@ -21,8 +39,10 @@ class Environment(config.Config):
'PKGS': self.pathgen('PKGS'),
'SPKGS': self.pathgen('SPKGS')
}
-
+ # complete_name is required to build proper path names.
+ # The use of "self" in this case may be deprecated in the future.
self.complete_name = self.key_dict['name'] + '-' + self.key_dict['version']
+ # Dictionary of package-leve directories
self.env_pkg = {
'BUILDROOT': os.path.join(self.env['BUILDROOT'], self.complete_name),
'BUILD': os.path.join(self.env['BUILD'], self.complete_name),
@@ -31,6 +51,9 @@ class Environment(config.Config):
'SPKGS': os.path.join(self.env['SPKGS'], self.complete_name)
}
+ # Generic utility mapping for platform specific configuration.
+ # Note: This is mainly to test script functionality on different platforms
+ # even though this library is VERY VERY Solaris 11 specific
self.tool = {
'tar': 'tar',
'unzip': 'unzip',
@@ -38,8 +61,13 @@ class Environment(config.Config):
'bunzip': 'bunzip'
}
+ # Oracle tar is ancient. GNU tar is preferrred.
if sys.platform == 'sunos5':
self.tool['tar'] = 'gtar'
def pathgen(self, path):
+ """Simplify path generation based on "ipsbuild" base path
+
+ path: directory leaf of 'ipsbuild' directory (in $HOME)
+ """
return os.path.join(self.__basepath, path)