All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

open-130: allow override of the downloads cache location

Review Request #537 - Created Jan. 19, 2012 and updated

Oz Linden Reviewers
open-130 jenn
None autobuild
In some users environment, the default download location is not appropriate.  Allow an environment variable that if set takes precedence.
I've been using this both with and without the variable set for some weeks and have not found any problem.

Diff revision 3 (Latest)

1 2 3
1 2 3

  1. autobuild/common.py: Loading...
  2. autobuild/tests/test_install.py: Loading...
autobuild/common.py
Revision e1687c2ac203 New Change
... 105 lines hidden [Expand]
def get_default_scp_command():
106
    scp = find_executable(['pscp', 'scp'], ['.exe'])
106
    scp = find_executable(['pscp', 'scp'], ['.exe'])
107
    return scp
107
    return scp
108
    
108
    
109
def get_autobuild_environment():
109
def get_autobuild_environment():
110
    """
110
    """
111
    Return an environment under which to execute autobuild subprocesses.
111
    Return an environment under which to execute autobuild subprocesses.
112
    """
112
    """
113
    return dict(os.environ, AUTOBUILD=os.environ.get(
113
    return dict(os.environ, AUTOBUILD=os.environ.get(
114
        'AUTOBUILD', get_autobuild_executable_path()))
114
        'AUTOBUILD', get_autobuild_executable_path()))
115

   
115

   
116
def get_default_install_cache_dir():
116
def get_install_cache_dir():
117
    """
117
    """
118
    In general, the package archives do not change much, so find a 
118
    In general, the package archives do not change much, so find a 
119
    host/user specific location to cache files.
119
    host/user specific location to cache files.
120
    """
120
    """
121
    cache = os.getenv('AUTOBUILD_INSTALLABLE_CACHE')
121
    cache = os.getenv('AUTOBUILD_INSTALLABLE_CACHE')
122
    if cache == None:
122
    if cache == None:
123
        cache = get_temp_dir("install.cache")
123
        cache = get_temp_dir("install.cache")
124
    else:
124
    else:
125
        if not os.path.exists(cache):
125
        if not os.path.exists(cache):
126
            os.makedirs(cache, mode=0755)
126
            os.makedirs(cache, mode=0755)
... 65 lines hidden [Expand]
def find_executable(executables, exts=None):
192
                if path:
192
                if path:
193
                    return path[0]
193
                    return path[0]
194
    return None
194
    return None
195

   
195

   
196
def get_package_in_cache(package):
196
def get_package_in_cache(package):
197
    """
197
    """
198
    Return the filename of the package in the local cache.
198
    Return the filename of the package in the local cache.
199
    The file may not actually exist.
199
    The file may not actually exist.
200
    """
200
    """
201
    filename = os.path.basename(package)
201
    filename = os.path.basename(package)
202
    return os.path.join(get_default_install_cache_dir(), filename)
202
    return os.path.join(get_install_cache_dir(), filename)
203

   
203

   
204
def is_package_in_cache(package):
204
def is_package_in_cache(package):
205
    """
205
    """
206
    Return True if the specified package has already been downloaded
206
    Return True if the specified package has already been downloaded
207
    to the local package cache.
207
    to the local package cache.
208
    """
208
    """
209
    return os.path.exists(get_package_in_cache(package))
209
    return os.path.exists(get_package_in_cache(package))
210
    
210
    
211
def compute_md5(path):
211
def compute_md5(path):
212
    """
212
    """
... 404 lines hidden [Expand]
autobuild/tests/test_install.py
Revision e1687c2ac203 New Change
 
  1. autobuild/common.py: Loading...
  2. autobuild/tests/test_install.py: Loading...