Re: [Rd] Version names

2004-11-28 Thread Gabor Grothendieck
Gabor Grothendieck  myway.com> writes:

> 
> Simon Urbanek  math.uni-augsburg.de> writes:
> 

> : If all you want to do is to determine the current (most recently 
> : installed) R version, then all it takes is two lines of C code [just 
> : read one registry entry] - and it's at least as portable across Windows 
> : systems as a batch script, but far more flexible. (There may even be a 
> : way to get that info w/o coding at all - I'm not sure whether regedit 
> : has any batch mode or something ...).
> 
> I don't think regedit has a batch mode.  e.g. regedit /? does not give help.

I looked into a bit more and some of this information is actually in 
the FAQ:


2.15 Does R use the Registry?
Not itself. 

The installers set some entries to allow uninstallation. In
addition (by default, but this can be de-selected) they set
a Registry key LOCAL_MACHINE\Software\R-core\R giving the
version and install path. Again, this is not used by R
itself, but it will be used by the DCOM interface
(http://cran.r-project.org/other-software.html). Finally, a
file association for extension .RData is set in the
Registry. 

You can add the Registry entries by running RSetReg.exe in
the bin folder, and remove them by running this with
argument /U. Note that the settings are all per machine and
not per user, and that this neither sets up nor removes the
file associations. 

Also it seems that one uses reg.exe rather than regedit.exe from 
batch files so putting all this together we get the following 
Windows XP batch statement to get the current path to the rw folder. 
It puts the path into the Rrw variable:

for /f "tokens=2*" %%a in (
'reg query hklm\software\r-core\r /v InstallPath') do set Rrw=%%b

The bad news is that this is not 100% guaranteed to work since, as mentioned
above, the user can deselect modification of the registry during installation
but its certainly more than sufficient for my purposes and probably most 
other purposes too.

Thanks for pointing the way.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Gabor Grothendieck
Simon Urbanek  math.uni-augsburg.de> writes:

: 
: On Nov 28, 2004, at 11:58 PM, Gabor Grothendieck wrote:
: 
: > Quite so but unfortunately if I want to produce a script
: > that has no dependencies then I need to use what is provided
: > in Windows and Windows batch commands seem to be the best
: > way to do that.
: 
: Batch scripts are also quite dependent on the system and settings used. 
: Moreover what are you trying to do? The rwXXX scheme is just a 
: suggestion, every user is free to change the name during the 
: installation, so there is no way to know by folder name which version 
: you're dealing with... The only half-way sensible solution I can think 
: of is looking for Rterm.exe and running each one to get the 
: corresponding R version - I suppose you can do that with a batch script 
: ;).

While what you say is true in the strict sense, batch scripts are usually
small simple scripts that get the job done quickly.  

In most cases I think its good enought that they work in 
non-pathalogical cases and that means searching for R 
in ., \Program Files\R\rw* and \R\rw* .  This would be easy
to do if the naming scheme were regular.

: 
: If all you want to do is to determine the current (most recently 
: installed) R version, then all it takes is two lines of C code [just 
: read one registry entry] - and it's at least as portable across Windows 

This just puts the problem one level off.  Now we need to know where 
the C file is.  The objective is to have a simple self contained script.
It would be possible to do it all in C but then its not a script
and its certainly not simple.

: systems as a batch script, but far more flexible. (There may even be a 
: way to get that info w/o coding at all - I'm not sure whether regedit 
: has any batch mode or something ...).

I don't think regedit has a batch mode.  e.g. regedit /? does not give help.
It would likely be possible to do it in vbscript and I may try that 
although I do think that that is leaving the realm of simplicity
and it think it shoulnd be easier to write a simple batch script 
that finds R.  I was putting off learning vbscript since I have
never needed it and Microsoft is moving to Monad/MSH for scripting
in Longhorn so I think vbscript may soon be orphaned.  Also I 
was hoping that at some point the entire package building 
process will migrate to R and scripts including perl, batch, UNIX-like
commands etc. will become unnecessary.

I quickly looked for the file where R sets the registry after reading
your post but could not quickly find it.  If anyone can provide the 
url to it in the svn repository or elsewhere that would helpful.

For the moment I have a viable workaround which is not to install
any R version that would be out of sequence (e.g. don't install
any beta or dev versions or if you do install a beta or dev version
don't install another version until the pat or next version number
comes out or delete the beta or dev version if you do).  This allows 
me to work with simple scripts.  These scripts do allow one to 
alternately specify the location of R explicitly through an
environment variable or to simply cd to the rw folder so its always 
possible to force a certain version even in the absence of such a protool.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Simon Urbanek
On Nov 28, 2004, at 11:58 PM, Gabor Grothendieck wrote:
Quite so but unfortunately if I want to produce a script
that has no dependencies then I need to use what is provided
in Windows and Windows batch commands seem to be the best
way to do that.
Batch scripts are also quite dependent on the system and settings used. 
Moreover what are you trying to do? The rwXXX scheme is just a 
suggestion, every user is free to change the name during the 
installation, so there is no way to know by folder name which version 
you're dealing with... The only half-way sensible solution I can think 
of is looking for Rterm.exe and running each one to get the 
corresponding R version - I suppose you can do that with a batch script 
;).

If all you want to do is to determine the current (most recently 
installed) R version, then all it takes is two lines of C code [just 
read one registry entry] - and it's at least as portable across Windows 
systems as a batch script, but far more flexible. (There may even be a 
way to get that info w/o coding at all - I'm not sure whether regedit 
has any batch mode or something ...).

Cheers,
Simon
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Gabor Grothendieck
Duncan Murdoch  stats.uwo.ca> writes:

: 
: On Sun, 28 Nov 2004 21:11:15 + (UTC), Gabor Grothendieck
:  myway.com> wrote:
: 
: >Renaming is not really workable if you are giving your scripts to others.
: >They won't want build scripts that rename their folders.  
: >
: >: Another possibility is to have your build script split up the name and
: >: apply a custom sort order to it.
: >: 
: >: The pattern is:
: >: 
: >: "rw" + version number + suffix
: >: 
: >: The suffices appear in this order:  "dev", "alpha", "beta", "", "pat"
: >: (where not all appear, e.g. "dev" never appears for a minor release,
: >: and sometimes "alpha" is skipped).
: >
: >Its really desirable to keep Windows batch scripts as simple as 
: >possible and such a transformation is trickier than you might
: >think in the Windows batch language. 
: 
: You need a better scripting language!  

Quite so but unfortunately if I want to produce a script
that has no dependencies then I need to use what is provided 
in Windows and Windows batch commands seem to be the best
way to do that.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Gabor Grothendieck
Peter Dalgaard  biostat.ku.dk> writes:

: 
: Gabor Grothendieck  myway.com> writes:
: 
: > : > rw2010a - alpha, i.e. development version (previously rw2010dev)
: > : > rw2010b - beta version (previously rw2001beta)
: > : > rw2010f - final version (previously rw2010)
: > : > rw2010p - patched version (previously rw2010pat)
: > : 
: > : That would work.  Use the rename command, and you've got it.
: > : 
: > 
: > Renaming is not really workable if you are giving your scripts to others.
: > They won't want build scripts that rename their folders.  
: ..
: > Its really desirable to keep Windows batch scripts as simple as 
: > possible and such a transformation is trickier than you might
: > think in the Windows batch language. 
: > 
: > I was hoping that the R team would consider a simplifying
: > change to make it easier to create build scripts.  The least such 
: > change that I can think of is to use alpha as a suffix in place of dev 
: > and to use final to suffix unsuffixed versions.  That would be enough to 
: > allow them to sort in ascending order.
: > 
: > This involves no coding at all for the R team.  Just a decision
: > to regularize the naming.
: 
: In a word, no, we won't do that. I'd certainly veto it if it came to
: that. 
: 
: It is a bad idea to have scripts depending on sort order (and R core
: has learned the hard way that sort order depends on locale), and it is
: an even worse idea to modify development concepts to fit a specificic
: alphabetical order. Case in point: A development version is _not_ the
: same as an alpha version!

I am pretty sure one could come up with a naming scheme that would
work in every locale.  If we used a, b, f and p then I doubt there
are any locales in which those are not increasing.  If that's not
true we could use numbers.  I really doubt that there are locales
in which digits are mot increasing.



:

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Duncan Murdoch
On Sun, 28 Nov 2004 21:11:15 + (UTC), Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:

>Renaming is not really workable if you are giving your scripts to others.
>They won't want build scripts that rename their folders.  
>
>: Another possibility is to have your build script split up the name and
>: apply a custom sort order to it.
>: 
>: The pattern is:
>: 
>: "rw" + version number + suffix
>: 
>: The suffices appear in this order:  "dev", "alpha", "beta", "", "pat"
>: (where not all appear, e.g. "dev" never appears for a minor release,
>: and sometimes "alpha" is skipped).
>
>Its really desirable to keep Windows batch scripts as simple as 
>possible and such a transformation is trickier than you might
>think in the Windows batch language. 

You need a better scripting language!  

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Peter Dalgaard
Gabor Grothendieck <[EMAIL PROTECTED]> writes:

> : >   rw2010a - alpha, i.e. development version (previously rw2010dev)
> : >   rw2010b - beta version (previously rw2001beta)
> : >   rw2010f - final version (previously rw2010)
> : >   rw2010p - patched version (previously rw2010pat)
> : 
> : That would work.  Use the rename command, and you've got it.
> : 
> 
> Renaming is not really workable if you are giving your scripts to others.
> They won't want build scripts that rename their folders.  
..
> Its really desirable to keep Windows batch scripts as simple as 
> possible and such a transformation is trickier than you might
> think in the Windows batch language. 
> 
> I was hoping that the R team would consider a simplifying
> change to make it easier to create build scripts.  The least such 
> change that I can think of is to use alpha as a suffix in place of dev 
> and to use final to suffix unsuffixed versions.  That would be enough to 
> allow them to sort in ascending order.
> 
> This involves no coding at all for the R team.  Just a decision
> to regularize the naming.

In a word, no, we won't do that. I'd certainly veto it if it came to
that. 

It is a bad idea to have scripts depending on sort order (and R core
has learned the hard way that sort order depends on locale), and it is
an even worse idea to modify development concepts to fit a specificic
alphabetical order. Case in point: A development version is _not_ the
same as an alpha version!

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Gabor Grothendieck
Duncan Murdoch  stats.uwo.ca> writes:

: 
: On Sun, 28 Nov 2004 18:09:20 + (UTC), Gabor Grothendieck
:  myway.com> wrote:
: 
: >
: >
: >I have Windows XP build scripts that look for R in a variety
: >of folders and if multiple ones are found, takes the last
: >one.  For example, I currently have the following 
: >in \Program Files\R :
: >
: > rw1060
: > rw1062
: > rw1071
: > rw1071beta
: > rw1081
: > rw1090
: > rw1090dev
: > rw1091
: > rw1091pat
: > rw2000
: > rw2001beta
: >
: >Note that it currently correctly gets rw2001beta but if I
: >add rw2001 then it will not pick it up since rw2001beta
: >would continue to sort after it.
: >
: >I tried using dates in my scripts to pick out the right one
: >but realized that it was somewhat error prone and decided to
: >move back to ordering by the names.
: >
: >I wonder if a naming convention could be adopted that ensured
: >that the names sort in order.  For example,
: >
: > rw2010a - alpha, i.e. development version (previously rw2010dev)
: > rw2010b - beta version (previously rw2001beta)
: > rw2010f - final version (previously rw2010)
: > rw2010p - patched version (previously rw2010pat)
: 
: That would work.  Use the rename command, and you've got it.
: 

Renaming is not really workable if you are giving your scripts to others.
They won't want build scripts that rename their folders.  

: Another possibility is to have your build script split up the name and
: apply a custom sort order to it.
: 
: The pattern is:
: 
: "rw" + version number + suffix
: 
: The suffices appear in this order:  "dev", "alpha", "beta", "", "pat"
: (where not all appear, e.g. "dev" never appears for a minor release,
: and sometimes "alpha" is skipped).

Its really desirable to keep Windows batch scripts as simple as 
possible and such a transformation is trickier than you might
think in the Windows batch language. 

I was hoping that the R team would consider a simplifying
change to make it easier to create build scripts.  The least such 
change that I can think of is to use alpha as a suffix in place of dev 
and to use final to suffix unsuffixed versions.  That would be enough to 
allow them to sort in ascending order.

This involves no coding at all for the R team.  Just a decision
to regularize the naming.

Currently I am the only user of my scripts so, as a workaround
I can delete the dev when I get the beta and delete the
beta when I get the final (or alternately just wait for the
final since the final/patch subset sort correctly) but it would 
be nice to have a simple general solution.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Version names

2004-11-28 Thread Duncan Murdoch
On Sun, 28 Nov 2004 18:09:20 + (UTC), Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:

>
>
>I have Windows XP build scripts that look for R in a variety
>of folders and if multiple ones are found, takes the last
>one.  For example, I currently have the following 
>in \Program Files\R :
>
>   rw1060
>   rw1062
>   rw1071
>   rw1071beta
>   rw1081
>   rw1090
>   rw1090dev
>   rw1091
>   rw1091pat
>   rw2000
>   rw2001beta
>
>Note that it currently correctly gets rw2001beta but if I
>add rw2001 then it will not pick it up since rw2001beta
>would continue to sort after it.
>
>I tried using dates in my scripts to pick out the right one
>but realized that it was somewhat error prone and decided to
>move back to ordering by the names.
>
>I wonder if a naming convention could be adopted that ensured
>that the names sort in order.  For example,
>
>   rw2010a - alpha, i.e. development version (previously rw2010dev)
>   rw2010b - beta version (previously rw2001beta)
>   rw2010f - final version (previously rw2010)
>   rw2010p - patched version (previously rw2010pat)

That would work.  Use the rename command, and you've got it.

Another possibility is to have your build script split up the name and
apply a custom sort order to it.

The pattern is:

"rw" + version number + suffix

The suffices appear in this order:  "dev", "alpha", "beta", "", "pat"
(where not all appear, e.g. "dev" never appears for a minor release,
and sometimes "alpha" is skipped).

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel