2

I am attempting to build a custom R package in Conda on Windows. The source is a local github repo, since the remote repo is private. Everything seems to go fine, but the package ends up being 9kb in size, and installs on the local machine during build time. That is to say, the install-able version that gets uploaded to Anaconda.org doesn't contain anything but the activate and deactivate scripts. So, I'd like to be able to build the package for others to use, but it appears to only be building on my local machine (to the local machine's R library folder, where it already exists!).

From lots of research, I think I need to set the prefix in either the yaml or bld.bat file, but I haven't a clue how to do this. Any help would be greatly appreciated. I am learning a lot about Conda through this process so I hope my question is sufficiently well-defined.

My meta.yaml looks like this:

{% set version = '0.0.0.9000' %}

{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: my_package
  version: {{ version|replace("-", "_") }}

source:
  fn: my_package_{{ version }}
  url: C:/_github/subdirectory/my_package
build:
  # If this is a new build for the same version, increment the build number.
  number: 0

  # This is required to make R link correctly on Linux.
  rpaths:
    - lib/R/lib/
    - lib/


requirements:
  build:
    - r-base
    - r-roxygen2
    - r-scales
    - r-jsonlite
    - r-foreign
    - r-ggplot2 >=2.1.0  
    - r-ca
    - r-openxlsx
    - r-plotly
  run:
    - r-base
    - r-roxygen2
    - r-scales
    - r-jsonlite
    - r-foreign
    - r-ggplot2 >=2.1.0  
    - r-ca
    - r-openxlsx
    - r-plotly

test:
  commands:
    # You can put additional test commands to be run here.
    - $R -e "library('package')"  # [not win]
    - "\"%R%\" -e \"library('package')\""  # [win]

And the bld.bat look like this:

"%R%" CMD INSTALL --build .
if errorlevel 1 exit 1
Patrick Williams
  • 694
  • 8
  • 22

0 Answers0