Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Remove / revise definition of xml2 classes #148

Closed
jimhester opened this issue Jul 26, 2019 · 2 comments
Closed

Remove / revise definition of xml2 classes #148

jimhester opened this issue Jul 26, 2019 · 2 comments

Comments

@jimhester
Copy link

So currently sos4R sets up the oldClass like

methods::setOldClass(Classes = c("xml_node", "xml_document"))

This unfortunately has the inheritance backwards, all xml_document objects are xml_node objects, but not vise versa. And actually there can exist xml_document objects that are not xml_node objects at all (though this is rare).

Unfortunately this conflicts with the definition in sos4R and means that sos4R installation fails with the devel version of xml2.

So either we can

  1. remove the setOldClass declarations from xml2 devel
  2. fix sos4R to make it consistent with xml2 devel and submit it to CRAN
@nuest
Copy link
Contributor

nuest commented Jul 26, 2019

Thanks for reaching out!

Since r-lib/xml2#248 is now closed please do submit to CRAN and we'll update sos4R and re-release to CRAN.

Or do you need us to make the release first?

nuest added a commit to nuest/sos4R that referenced this issue Jul 29, 2019
@nuest
Copy link
Contributor

nuest commented Jul 29, 2019

xml2 version 1.2.1 is on CRAN now, however I get warnings:

install.packages("xml2", repos = c("https://cran.r-project.org"))
==> R CMD INSTALL --no-multiarch --with-keep.source sos4R

* installing to library ‘/home/daniel/R/x86_64-pc-linux-gnu-library/3.6’
* installing *source* package ‘sos4R’ ...
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Warning: class "xml_document" is defined (with package slot ‘xml2’) but no metadata object found to revise superClass information---not exported?  Making a copy in package ‘sos4R’
Warning: class "xml_node" is defined (with package slot ‘xml2’) but no metadata object found to revise superClass information---not exported?  Making a copy in package ‘sos4R’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sos4R)

Not much information on that warning message out there, but the second link is an excellent resource:

@jimhester I did not foresee this, should have checked with an installation from GitHub first.

Solution attempts

importClassesFrom("xml2", "xml_document") leads to installation error:

* installing to library ‘/home/daniel/R/x86_64-pc-linux-gnu-library/3.6’
* installing *source* package ‘sos4R’ ...
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
Error: class "xml_document" is not exported by 'namespace:xml2'
Execution halted
ERROR: lazy loading failed for package ‘sos4R’

Does not work.

Try to export the classes in xml2

Changes in xml2: r-lib/xml2#267

Installation of sos4R works locally with this change: https://github.com/52North/sos4R/compare/master...nuest:bugfix/xml2-classes?expand=1

==> R CMD INSTALL --no-multiarch --with-keep.source sos4R

* installing to library ‘/home/daniel/R/x86_64-pc-linux-gnu-library/3.6’
* installing *source* package ‘sos4R’ ...
** using staged installation
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sos4R)

@nuest nuest closed this as completed in 96763e3 Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants