docs: def modify_environment(self, env):
          """Maintaining compatibility with different CASA versions is a pain."""
  
          # Ugh. I don't see any way out of special-casing the RPM-based
          # installations ... which only exist on NRAO computers, AFAICT.
          # Hardcoding 64-bitness, hopefully that won't come back to bite me.
          is_rpm_install = self._rootdir.startswith('/usr/lib64/casapy/release/')
  
          def path(*args):
              return os.path.join(self._rootdir, *args)
  
          env['CASAROOT'] = path()
          env['CASAPATH'] = ' '.join([path(),
                                      os.uname()[0].lower(),
                                      'local',
                                      os.uname()[1]])
  
          if is_rpm_install:
              env['CASA_INSTALLATION_TYPE'] = 'rpm-installation'
              prepend_environ_path(env, 'PATH', '/usr/lib64/casa/01/bin')
              prepend_environ_path(env, 'PATH', path('bin'))
          else:
              env['CASA_INSTALLATION_TYPE'] = 'tar-installation'
  
              lib = 'lib64' if os.path.isdir(path('lib64')) else 'lib'
              # 4.3.1 comes with both python2.6 and python2.7???
              pydir = sorted(glob.glob(path(lib, 'python2*')))[-1]
  
              tcldir = path('share', 'tcl')
              if os.path.isdir(tcldir):
                  env['TCL_LIBRARY'] = tcldir
              else:
                  tcl_versioned_dirs = glob.glob(path('share', 'tcl*'))
                  if len(tcl_versioned_dirs):
                      env['TCL_LIBRARY'] = tcl_versioned_dirs[-1]
  
              bindir = path(lib, 'casa', 'bin')
              if not os.path.isdir(bindir):
                  bindir = path(lib, 'casapy', 'bin')
              prepend_environ_path(env, 'PATH', bindir)
  
              env['CASA_INSTALLATION_DIRECTORY'] = env['CASAROOT']
              env['__CASAPY_PYTHONDIR'] = pydir
              env['MATPLOTLIBRC'] = path('share', 'matplotlib')
              env['PYTHONHOME'] = env['CASAROOT']
              env['TK_LIBRARY'] = path('share', 'tk')
              env['QT_PLUGIN_PATH'] = path(lib, 'qt4', 'plugins')
  
              prepend_environ_path(env, 'LD_LIBRARY_PATH', path(lib))
              # should we overwite PYTHONPATH instead?
              prepend_environ_path(env, 'PYTHONPATH', os.path.join(pydir, 'site-packages'))
              prepend_environ_path(env, 'PYTHONPATH', os.path.join(pydir, 'heuristics'))
              prepend_environ_path(env, 'PYTHONPATH', pydir)
  
          return env