From hb at biostat.ucsf.edu  Mon Nov 28 18:10:52 2011
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Mon, 28 Nov 2011 09:10:52 -0800
Subject: [Rd] Avoid package in build process when not supported on OS
In-Reply-To: <5B2F2CD24AD2764D898AF5A7B9A2ABBF01FB13EC@hermes.demogr.mpg.de>
References: <5B2F2CD24AD2764D898AF5A7B9A2ABBF01FB13EC@hermes.demogr.mpg.de>
Message-ID: <CAFDcVCTKskYAycP-jrp8xGCoT83EtuugQ2WzdM-O6ayeVhmSqg@mail.gmail.com>

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
>



[Rd] Avoid package in build process when not supported on OS
Henrik Bengtsson