summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'g_cran/g_cran.py')
-rw-r--r--g_cran/g_cran.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/g_cran/g_cran.py b/g_cran/g_cran.py
index 51fa588..6898109 100644
--- a/g_cran/g_cran.py
+++ b/g_cran/g_cran.py
@@ -12,7 +12,16 @@ def action_sync(repo_location,remote_uri):
if not os.path.isdir(os.path.join(repo_location, REPO_MYDIR)):
os.mkdir(os.path.join(repo_location,REPO_MYDIR))
packages_filename=os.path.join(repo_location, REPO_MYDIR, 'PACKAGES')
- urllib.urlretrieve(remote_uri+'/src/contrib/PACKAGES',packages_filename)
+ packages_rds_filename=os.path.join(repo_location, REPO_MYDIR, 'packages.rds')
+ try:
+ #we first try to get a serialized full database... this works for CRAN
+ urllib.urlretrieve(remote_uri+'/web/packages/packages.rds',packages_rds_filename)
+ R_script=os.path.join(os.path.dirname(__file__),'convert_packages_rds.R')
+ returncode=os.system('R --quiet --file='+R_script+' --args '+packages_rds_filename+' '+packages_filename)
+ if returncode:
+ raise RuntimeError('Could not convert packages.rds')
+ except:
+ urllib.urlretrieve(remote_uri+'/src/contrib/PACKAGES',packages_filename)
repo_file=open(os.path.join(repo_location,REPO_MYDIR,'remote_uri'),'w')
repo_file.write(remote_uri)