Git Product home page Git Product logo

gran's People

Contributors

benmarwick avatar cedarops avatar cicdguy avatar github-rena avatar gmbecker avatar juliangehring avatar vobencha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gran's Issues

normalizePath2 makes incorrect assumptions about path names in Windows

The package vignette fails in windows, in the step makeSingleGRANRepo().

I traced the first problem to normalizePath2(), where the code makes some assumptions about path names that don't seem to hold for Windows.

Reproducible example:

repdir = file.path(tempdir(), "repos")
> normalizePath2(repdir)
[1] "C:/Users/Andrie/Documents/GitHub/gRAN/C:\\Users\\Andrie\\AppData\\Local\\Temp\\RtmpszdDv8/repos"

Note the ..../gRAN/C::\\Users\\...

If I rewrite normalizePath2() by commenting out four lines toward the bottom, this problem goes away on Windows, but I don't know what the impact will be on other operating systems.

normalizePath2 = function(path, follow.symlinks=FALSE)
{
  if(follow.symlinks)
    normalizePath(path)
  else {
    path <- path.expand(path)
    fileSep <- .Platform$file.sep
    wd <- getwd()
    if(substr(path, 1, 1) == "~")
      path = path.expand(path)
    ##paths starting with / for example
    else if(substr(path, 1, 1) == fileSep)

      path  = path
    else if (substr(path, 1, 2) == "..") {
      tmppath = wd
      while(substr(path, 1, 2) == "..") {
        tmppath = dirname(tmppath)
        path = substr(path, 3, nchar(path))
        if(substr(path, 1, 1) == fileSep)
          path = substr(path, 2, nchar(path))
      }
      path = file.path(tmppath, path)
    } 
#     else if(grepl("^\\.*[[:alnum:]]", path))
#       path = file.path(wd, path)
#     else if (substr(path, 1,1) == ".")
#       path = file.path(wd, substr(path,2, nchar(path)))
    path = gsub(paste(rep(fileSep, 2), collapse=""), fileSep, path, fixed=TRUE)
    path

  }
}

GRANonGRAN() tries to copy non-existent files

In the function GRANonGRAN() the following lines fail:

    res = file.copy(system.file("GRAN", package="GRANBase"),
              normalizePath2(repobase(repo)), recursive=TRUE,
              overwrite=TRUE)
    if(any(!res))
        stop("copy failed")

The reason is that the file "GRAN" doesn't seem to exist in GRANbase

system.file("GRAN", package="GRANBase")
[1] ""

Should this line refer to a different folder?

best way to locally capture and restore packages

Thanks for joining @cboettig and I at cboettig/nonparametric-bayes#55 (comment) I wonder if you could advise me if I've got the right idea here:

I've got your package on my computer with this...

# needed to build the vignette
source("http://bioconductor.org/biocLite.R")
biocLite("BiocStyle")

# get the package from github and build the vingette, takes a minute or two
devtools::install_github("gmbecker/gRAN", build_vignettes = TRUE)

Now I'm doing some work, for example...

# do some work, for example with these packages...
library(MASS)
library(gender)
# ... do various analyses...

Now I want to capture my working environment by getting the packages currently used by my R session for this analysis and store them locally where I can have a compendium that includes my R scripts and a nearby directory with the versions of the packages used in those scripts. Am I on the right track with this next bit?

# gets the CRAN packages of the packages in currently attached and stores
# them locally. You'd do this at the end of an analysis when all the libraries
# you've used are loaded in the environment, ie. at the end of a Rmd file. 

path <- getwd() # where the packages will be downloaded to
my_local_repo <- "my_local_repo" # name of local repo
session_packages <- sessionRepo(sessionInfo(), repo_dir = path, dir = path, 
                        libloc = path,
                        stoponfail = FALSE, # skip github pkgs, not supported
                        replace = TRUE, # update previous virtual repository
                        name = "my_local_repo") # give it a name

# Now we have a local repository of packages that match the ones used
# for this analysis. Let's say we archive all of this somewhere, ready to return to 
# some time later. 

Time passes... we want to go back to that work we did earlier and install those local old packages into our current env...

# Now I want I want to draw on this local repository
# to load the same libraries that were used to generate the archive. We don't
# want to download them again because we might not have good internet access,
# or we're not sure they'll still be online, etc. So let's install packages 
# from this local repository that we just created in the previous line.
# Assuming we are in the project directory, and that we have saved
# `session_packages` somewhere when we did the earlier work...

# get the paths to each individual package
session_packages_paths  <- list.files(session_packages, full.names = TRUE)

# make a directory for the local library
my_local_library <- paste0(getwd(), "/my_local_library")

# install the packages to that local library, have to respond with 'y'
# at the prompts to create a personal library:

install.packages(session_packages_paths, 
                 repos = NULL, 
                 type =" source", 
                 lib = my_local_library)

# inspect the current session
sessionInfo()
# inspect the local custom library
library(lib.loc = my_local_library)

I'm not sure what's going on here, do I now have those old local packages installed in my current env, is that correct? Is this the right way about it, or is there a simpler way?

thanks!

Undocumented prerequisites

First of: kudos for trying to ensure reproducibility!

Forgive me if I might have overlooked it, but I think you forgot to document some prerequisites that must be met in order to get your package up and running.

After reading your post and trying to install
gRAN (or GRANBase as it's called in your post?), I experienced the following issues due to missing package dependencies:

  1. BiocInstaller needs to be installed first.

  2. BiocStyle needs to be installed first.

  3. After installing these packages, I still get the following error:

    • checking for file 'C:\Users\jat\AppData\Local\Temp\RtmpYXNZw4\devtools1ef44d404295\gRAN-master/DESCRIPTION' ... OK
    • preparing 'GRANBase':
    • checking DESCRIPTION meta-information ... OK
    • installing the package to build vignettes
    • creating vignettes ...Warning: running command '"Q:/home/apps/RAPPTO1/apps/r/R-311.1/bin/x64/Rscript" --vanilla --default-packages= -e "tools::buildVignettes(dir = '.', tangle = TRUE)"' had status 1
      ERROR

    Error: processing vignette 'GRAN-Overview.Rnw' failed with diagnostics:
    chunk 3
    Error in GRANonGRAN(repo) : copy failed
    Execution halted

This is the code I ran:

source("http://bioconductor.org/biocLite.R")
biocLite("BiocInstaller")
biocLite("BiocStyle")

require("devtools")
install_github("gRAN", "gmbecker")

My sessionInfo():

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BiocInstaller_1.14.2 devtools_1.5        

loaded via a namespace (and not attached):
 [1] digest_0.6.4    evaluate_0.5.5  httr_0.4        memoise_0.2.1  
 [5] packrat_0.4.0.4 parallel_3.1.1  RCurl_1.95-4.3  stringr_0.6.2  
 [9] tools_3.1.1     whisker_0.3-2  

.to_gran_url stop can prevent useful subsequent functionality

In the commit 5eee55e
the function .to_gran_url was added which adds the code:

stopifnot(grepl(dest_base(repo), path, fixed = TRUE))

In buildBadge, if (is.na(status) || status == "NA"), log/path = "" so this will always hit the stop case and can prevent useful subsequent functionality in makeRepo like saveRepo. Could a more lenient response than stopping be taken in general?

gRAN install fails on Ubuntu 14.04 with R 3.1

install_git("https://github.com/gmbecker/gRAN")
...
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
pdflatex is not available
Error in running tools::texi2pdf()
Warning messages:
1: running command 'R_LIBS_USER=/tmp/RtmprzUi6o/repos/stable/LibLoc R CMD build /tmp/RtmprzUi6o/repos/tmpcheckout/GRAN/./. --resave-data' had status 1
2: In buildBranchesInRepo(repo, temp = FALSE, incremental = FALSE, :
Warning: not all packages were succesfully built
3: running command 'R_LIBS='/tmp/RtmprzUi6o/repos/stable/LibLoc' R CMD check toypkg_1.0.tar.gz' had status 1
Warning in removeNodes.list(kids) :
removeNode only works on internal nodes at present
Warning in removeNodes.list(kids) :
removeNode only works on internal nodes at present
Warning in read.dcf(file = tmpf) :
cannot open compressed file '/tmp/RtmprzUi6o/repos/stable/src/contrib/PACKAGES', probable reason 'No such file or directory'

Error: processing vignette 'GRAN-Overview.Rnw' failed with diagnostics:
chunk 4
Error in read.dcf(file = tmpf) : cannot open the connection
Execution halted
Error: Command failed (1)

clear staging repo when builds start

@gmbecker Currently the staging/ directory is wiped when the builds complete (migrateToFinalRepo()) so those products are not available for troubleshooting. We'd like to instead cleanse staging/ in makeRepo() when the builds start. If you don't see a problem with this I'll submit a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.