Rau, Roland
2011-Nov-28 15:39 UTC
[Rd] Avoid package in build process when not supported on OS
Dear all, I am currently working on a package which involves some simulation where no current simulation run depends on a previous simulation run. That is why I decided to parallelize the computation using the doMC package (which exists only for unix-like OS). I can create a package without any R CMD check and R CMD build errors on my computers (Ubuntu Linux 32bit & 64 bit). The problem that I have is: I would like to make the package platform-independent. In this case, this should not be difficult. A simple: if (!(.Platform$OS.type=="unix")) { .... } allows me to specify a different execution path on non unix-like operating systems (i.e. not using doMC-code, resulting in running the code not in parallel). I just tried it out and uploaded the source package to http://win-builder.r-project.org/ Unfortunately, I get the following result: [...] * checking package dependencies ... ERROR Package required but not available: 'doMC' [...] I interpret it as such: Even if the package will never be required (for a particular OS) the build process nevertheless checks whether the packages exists for the respective platform. What would you suggest? Create two packages (mypackage vs. mypackageNONUNIX)? Release only for unix-like systems? ...? Thank you in advance, Roland ---------- This mail has been sent through the MPI for Demographic ...{{dropped:10}}
Henrik Bengtsson
2011-Nov-28 17:10 UTC
[Rd] Avoid package in build process when not supported on OS
Move doMC from Requests: to Suggests: and load it in the code when needed, e.g. library("doMC"). BTW, make sure you are aware of the new 'parallel' package that comes with R v2.14.0. /H On Mon, Nov 28, 2011 at 7:39 AM, Rau, Roland <Rau at demogr.mpg.de> wrote:> Dear all, > > I am currently working on a package which involves some simulation where no current simulation run depends on a previous simulation run. > That is why I decided to parallelize the computation using the doMC package (which exists only for unix-like OS). > > I can create a package without any R CMD check and R CMD build errors on my computers (Ubuntu Linux 32bit & 64 bit). > > The problem that I have is: I would like to make the package platform-independent. In this case, this should not be difficult. A simple: > > if (!(.Platform$OS.type=="unix")) { > ?.... > } > > allows me to specify a different execution path on non unix-like operating systems (i.e. not using doMC-code, resulting in running the code not in parallel). > > I just tried it out and uploaded the source package to http://win-builder.r-project.org/ > > Unfortunately, I get the following result: > [...] > * checking package dependencies ... ERROR > Package required but not available: 'doMC' > [...] > > I interpret it as such: Even if the package will never be required (for a particular OS) the build process nevertheless checks whether the packages exists for the respective platform. > What would you suggest? Create two packages (mypackage vs. mypackageNONUNIX)? Release only for unix-like systems? ...? > > Thank you in advance, > Roland > > > > ---------- > This mail has been sent through the MPI for Demographic ...{{dropped:10}} > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >