[R-pkg-devel] Problem persists, was Re: Problem compressing vignettes for CRAN

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Mon Oct 9 17:22:17 CEST 2023


Dear Ivan (and list)

Using Ivan's advice I traced the problem to a difference of opinio 
between Microsoft and R about paht names. I had mistakenly enclosed 
parts of the names in "" which was fine for MS but not R. Sys.which() 
was my saviour here.

Many thanks to Ivan for broadening my knowledge of useful functions like 
Sys.which().

Michael

On 09/10/2023 08:51, Ivan Krylov wrote:
> On Sun, 8 Oct 2023 16:47:41 +0100
> Michael Dewey <lists using dewey.myzen.co.uk> wrote:
> 
>> Following on from Ivan's advice I have now installed qpdf and
>> Ghostview. I have checked that they are both on my path by typing
>> their name at the command line and verifying they open.
> 
>> I then built the package with the --compress-vignettes=both and then
>> checked it with --as-cran I still get a complaint that it needs qpdf
>> to check compression.
> 
> While running R, does Sys.which('qpdf') return the path to qpdf.exe?
> Does Sys.getenv('PATH') match your expectations?
> 
>> I notice that in the Writing R Extensions manual in section 1.6.1 it
>> states "The full path to the qpdf command can be supplied as
>> environment variable R_QPDF ..."
>>
>> Is that a typo for "must be supplied"?
> 
> Well, R tries to resolve the path to qpdf.exe using Sys.which(), so it
> must work if it's on the %PATH%, but if all else fails, setting this
> environment variable should help.
> 
>> If it is where can I find the answers to questions about how R
>> accepts Windows paths? Do I need to enclose parts of names containing
>> spaces in "" signs?
> 
> It always depends on how the final command line is built by a
> particular function, but it should work by taking plain file paths
> without any escaping and quotation. The directory separators shouldn't
> matter either.
> 
> (tools::compactPDF uses system2(), so it quotes the path to the
> executable by itself.)
> 
>> Does it mean the path up to, in this case, bin or must I include
>> qpdf.exe after it?
> 
> It must be the full path to the executable, including the final
> qpdf.exe.
> 
>> I assume I do not need to do anything special to get it to find
>> Ghostscript?
> 
> tools::compactPDF() expects gswin64c.exe or gswin32c.exe on the PATH.
> If it's not there, R_GSCMD must be set to the full path to the
> executable. Judging by the NOTE you've received, it's Ghostscript that
> performed most of the compaction in your case.
> 

-- 
Michael




More information about the R-package-devel mailing list