From pgilbert902 at gmail.com  Thu Oct 31 18:45:29 2013
From: pgilbert902 at gmail.com (Paul Gilbert)
Date: Thu, 31 Oct 2013 13:45:29 -0400
Subject: [Rd] Where to drop a python script?
In-Reply-To: <52729061.4050504@stats.ox.ac.uk>
References: <CABG0rfvUzodJ6c22tU6E+yS_Z1NxieQE+afOAHZ4m+wvjcW2Dg@mail.gmail.com>	<21105.23279.974154.140323@max.nulle.part>	<5271A6F7.8070904@gmail.com>
	<52720032.5060702@stats.ox.ac.uk> <52727852.4000008@gmail.com>
	<52729061.4050504@stats.ox.ac.uk>
Message-ID: <52729739.4050401@gmail.com>



On 13-10-31 01:16 PM, Prof Brian Ripley wrote:
> On 31/10/2013 15:33, Paul Gilbert wrote:
>>
>>
>> On 13-10-31 03:01 AM, Prof Brian Ripley wrote:
>>> On 31/10/2013 00:40, Paul Gilbert wrote:
>>>> The old convention was that it went in the exec/ directory, but as you
>>>> can see at
>>>> http://cran.at.r-project.org/doc/manuals/r-devel/R-exts.html#Non_002dR-scripts-in-packages
>>>>
>>>>
>>>>
>>>>   it can be in inst/anyName/. A minor convenience of exec/ is that the
>>>> directory has the same name in source and when installed, whereas
>>>> inst/anyName gets moved to anyName/, so debugging can be a tiny bit
>>>> easier with exec/.
>>>>
>>>> Having just put a package (TSjson) on CRAN with a python script, here
>>>> are a few other pointers for getting it on CRAN:
>>>>
>>>> -SystemRequirements: should indicate if a particular version of python
>>>> is needed, and any non-default modules that are needed. (My package
>>>> does
>>>> not work with Python 3 because some modules are not available.) Some of
>>>> the libraries have changed, so it could be a bit tricky to make
>>>> something work easily with both 2 and 3.
>>>>
>>>> -You need a README to explain how to install Python. (If you look at or
>>>> use mine, please let me know if you find problems.)
>>>
>>> Better to describe exactly what you need: installation instructions go
>>> stale very easily.
>>>
>>>> -The Linux and Sun CRAN test machines have Python 2 whereas winbuilder
>>>> has Python 3. Be prepared to explain that the package will not work on
>>>> one or the other.
>>>
>>> Not true.  Linux and Solaris (sic) have both: the Solaris machines have
>>> 2.6 and 3.3.
>>
>> For an R package how does one go about specifying which should be used?
>
> You ask the user to tell you the path or at least the command name, e.g.
> by an environment variable or R function argument.  Just like any other
> external program such as GhostScript.

Yes, but since I don't have direct access to the CRAN test machines, 
specifically, on the CRAN test machines, how do I specify to use Python 
2 or Python 3? (That is, I think you are the user when CRAN tests are 
done on Solaris, so I am asking you.)

>
>>
>>> Please do not spread misinformation about machines you do
>>> not have any access to.
>>>
>>>>
>>>> Another option to system() is pipe()
>>>>
>>>> Paul
>>>>
>>>> On 13-10-30 03:15 PM, Dirk Eddelbuettel wrote:
>>>>>
>>>>> On 30 October 2013 at 13:54, Jonathan Greenberg wrote:
>>>>> | R-developers:
>>>>> |
>>>>> | I have a small python script that I'd like to include in an R
>>>>> package I'm
>>>>> | developing, but I'm a bit unclear about which subfolder it should go
>>>>> in.  R
>>>>> | will be calling the script via a system() call.  Thanks!
>>>>>
>>>>> Up to you as you control the path. As "Writing R Extensions" explains,
>>>>> everything below the (source) directory inst/ will get installed.  I
>>>>> like
>>>>> inst/extScripts/ (or similar) as it denotes that it is an external
>>>>> script.
>>>>>
>>>>> As an example, the gdata package has Perl code for xls reading/writing
>>>>> below a
>>>>> directory inst/perl/ -- and I think there are more packages doing
>>>>> this.
>>>>>
>>>>> Dirk
>>>>>
>>>>>
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>
>



[Rd] Where to drop a python script?
Paul Gilbert