Skip to content

Commit 40941c2

Browse files
Merge pull request #12 from andyquinterom/CRAN_FEEDBACK
Cran feedback
2 parents 8c6e474 + 6bb9695 commit 40941c2

12 files changed

+60
-71
lines changed

.Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
^src/rust/.cargo$
1212
^src/rust/.vscode$
1313
^src/rust/vendor$
14+
^src/rust/target$
1415

1516
^_pkgdown\.yml$
1617
^docs$

DESCRIPTION

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ Authors@R:
99
person(given = "The authors of the dependency Rust crates",
1010
role = c("ctb"),
1111
comment = "see inst/AUTHORS file for details"))
12-
Description: A set of optimized tools and abstractions for processing graph data structures.
12+
Description: Empower your data analysis with 'orbweaver', an R package
13+
designed for effortless construction and analysis of graph data
14+
structures. With 'orbweaver', you can seamlessly build and manipulate
15+
graph structures, leveraging its high-performance methods for
16+
filtering, joining, and mutating data within the R environment.
17+
Drawing inspiration from the efficiency of the 'data.table'
18+
package, 'orbweaver' ensures that mutations and changes to
19+
the graph are performed in place, streamlining your
20+
workflow for optimal productivity.
1321
URL: https://github.com/ixpantia/orbweaver
1422
BugReports: https://github.com/ixpantia/orbweaver/issues
1523
License: MIT + file LICENSE

R/graph.R

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#' Initializes a new graph with the given type.
55
#' @param type The type of graph to create. Currently only `acyclic` is
66
#' supported.
7+
#' @return A new graph of the given type.
78
#' @export
89
new_graph <- function(type) {
910
switch(
@@ -21,7 +22,7 @@ new_graph <- function(type) {
2122
#' @param type The type of graph to convert to. Currently only `acyclic` is
2223
#' supported.
2324
#' @param ... Additional arguments passed to the method.
24-
#' @return A graph.
25+
#' @return A graph of the given type.
2526
#' @export
2627
as_graph <- function(x, type, ...) {
2728
UseMethod("as_graph")
@@ -35,7 +36,7 @@ as_graph <- function(x, type, ...) {
3536
#' @param type The type of graph to convert to. Currently only `acyclic` is
3637
#' supported.
3738
#' @param ... Ignored.
38-
#' @return A graph.
39+
#' @return A graph of the given type.
3940
#' @export
4041
as_graph.data.frame <- function(x, type, ...) {
4142
switch(
@@ -55,7 +56,7 @@ as_graph.data.frame <- function(x, type, ...) {
5556
#' similar way to the `data.table` package.
5657
#' @param graph The graph to add the node to.
5758
#' @param node The ID of the node to add.
58-
#' @return The graph.
59+
#' @return A reference to the graph passed in.
5960
#' @export
6061
add_node <- function(graph, node) {
6162
graph$add_node(node)
@@ -74,7 +75,7 @@ add_node <- function(graph, node) {
7475
#' @param graph The graph to add the child to.
7576
#' @param parent The ID of the parent node.
7677
#' @param child The ID of the child node.
77-
#' @return The graph.
78+
#' @return A reference to the graph passed in.
7879
#' @export
7980
add_child <- function(graph, parent, child) {
8081
graph$add_child(parent, child)
@@ -163,7 +164,7 @@ find_roots <- function(graph) {
163164
#' @description
164165
#' Creates a copy of the graph.
165166
#' @param graph The graph to clone.
166-
#' @return A new graph.
167+
#' @return A new graph that is a copy of the original.
167168
#' @export
168169
clone_graph <- function(graph) {
169170
graph$graph_clone()

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# orbweaver
22

3+
<!-- badges: start -->
4+
[![CRAN status](https://www.r-pkg.org/badges/version/orbweaver)](https://cran.r-project.org/package=orbweaver)
5+
[![R-CMD-check](https://github.com/ixpantia/orbweaver/actions/workflows/check-full.yaml/badge.svg)](https://github.com/ixpantia/orbweaver/actions/workflows/check-full.yaml)
6+
<!-- badges: end -->
7+
8+
## Overview
9+
310
A fast R library for working with Nodes in a graph. This library
411
modifies graphs in place, similar to how [data.table](https://github.com/Rdatatable/data.table)
512
modifies data.frames in place. This allows for fast and memory efficient

man/add_child.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_node.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/as_graph.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/as_graph.data.frame.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/clone_graph.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/new_graph.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Makevars

+9-18
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,26 @@ TARGET_DIR = ./rust/target
66
LIBDIR = $(TARGET_DIR)/release
77
STATLIB = $(LIBDIR)/liborbweaver.a
88
PKG_LIBS = -L$(LIBDIR) -lorbweaver
9+
CARGOTMP = ./rust/.cargo/tmp
910

1011
all: C_clean
1112

1213
$(SHLIB): $(STATLIB)
1314

1415
$(STATLIB):
15-
# vendoring (Note: to avoid NOTE of "Found the following hidden files and
16-
# directories", .cargo needs to be created here)
1716
if [ "$(VENDORING)" = "yes" ]; then \
1817
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust && \
1918
mkdir -p ./rust/.cargo && \
2019
cp ./config/cargo_vendor_config.toml ./rust/.cargo/config.toml; \
21-
fi
22-
23-
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
24-
# to set it here to ensure cargo can be invoked. It is appended to PATH and
25-
# therefore is only used if cargo is absent from the user's PATH.
26-
if [ "$(NOT_CRAN)" != "true" ]; then \
27-
export CARGO_HOME=$(CARGOTMP); \
2820
fi && \
29-
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
30-
cd ./rust && \
31-
cargo build --lib --release \
32-
$(OFFLINE_OPTION) \
33-
--jobs 1
34-
if [ "$(NOT_CRAN)" != "true" ]; then \
35-
rm -Rf $(CARGOTMP) && \
36-
rm -Rf $(LIBDIR)/build; \
37-
fi
21+
export CARGO_HOME=$(CARGOTMP); \
22+
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
23+
cd ./rust && \
24+
cargo build --lib --release \
25+
$(OFFLINE_OPTION) \
26+
--jobs 1; \
27+
rm -Rf $(CARGOTMP) && \
28+
rm -Rf $(LIBDIR)/build; \
3829

3930
C_clean:
4031
rm -Rf $(SHLIB) $(OBJECTS) ./rust/.cargo $(STATLIB)

src/Makevars.win

+20-42
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,39 @@
1-
TARGET = x86_64-pc-windows-gnu
2-
3-
# Rtools42 doesn't have the linker in the location that cargo expects, so we
4-
# need to overwrite it via configuration.
5-
CARGO_LINKER = x86_64-w64-mingw32.static.posix-gcc.exe
6-
7-
# TODO
8-
VENDORING = yes
91
OFFLINE_OPTION = --offline
2+
VENDORING = yes
3+
4+
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
105

116
TARGET_DIR = ./rust/target
127
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
138
STATLIB = $(LIBDIR)/liborbweaver.a
149
PKG_LIBS = -L$(LIBDIR) -lorbweaver -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll
10+
CARGOTMP = ./rust/.cargo/tmp
11+
TAR=tar
1512

1613
all: C_clean
1714

1815
$(SHLIB): $(STATLIB)
1916

20-
$(STATLIB):
21-
mkdir -p $(LIBDIR)/libgcc_mock && touch $(LIBDIR)/libgcc_mock/libgcc_eh.a
17+
CARGOTMP = $(CURDIR)/.cargo
2218

23-
# vendoring (Note: to avoid NOTE of "Found the following hidden files and
24-
# directories", .cargo needs to be created here)
19+
$(STATLIB):
20+
mkdir -p $(TARGET_DIR)/libgcc_mock && \
21+
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a && \
2522
if [ "$(VENDORING)" = "yes" ]; then \
2623
$(TAR) --extract --xz -f ./rust/vendor.tar.xz -C ./rust && \
27-
mkdir -p ./rust/.cargo && \
28-
cp ./config/cargo_vendor_config.toml ./rust/.cargo/config.toml; \
29-
fi
30-
31-
mkdir -p $(TARGET_DIR)/libgcc_mock
32-
# `rustc` adds `-lgcc_eh` flags to the compiler, but Rtools' GCC doesn't have
33-
# `libgcc_eh` due to the compilation settings. So, in order to please the
34-
# compiler, we need to add empty `libgcc_eh` to the library search paths.
35-
#
36-
# For more details, please refer to
37-
# https://github.com/r-windows/rtools-packages/blob/2407b23f1e0925bbb20a4162c963600105236318/mingw-w64-gcc/PKGBUILD#L313-L316
38-
touch $(TARGET_DIR)/libgcc_mock/libgcc_eh.a
39-
40-
# CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2
41-
if [ "$(NOT_CRAN)" != "true" ]; then \
42-
export CARGO_HOME=$(CARGOTMP); \
24+
mkdir -p ./rust/.cargo && \
25+
cp ./config/cargo_vendor_config.toml ./rust/.cargo/config.toml; \
4326
fi && \
44-
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
45-
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \
46-
cd ./rust && \
47-
cargo build --target=$(TARGET) --lib --release \
48-
$(OFFLINE_OPTION) \
49-
--jobs 1
50-
if [ "$(NOT_CRAN)" != "true" ]; then \
51-
rm -Rf $(CARGOTMP) && \
52-
rm -Rf $(LIBDIR)/build; \
53-
fi
27+
export CARGO_HOME=$(CARGOTMP); \
28+
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
29+
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \
30+
cd ./rust && \
31+
cargo build --target=$(TARGET) --lib --release $(OFFLINE_OPTION) --jobs 1; \
32+
rm -Rf $(CARGOTMP) && \
33+
rm -Rf $(LIBDIR)/build; \
5434

5535
C_clean:
56-
rm -Rf $(SHLIB) $(OBJECTS) ./rust/.cargo $(STATLIB)
36+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)
5737

5838
clean:
59-
rm -Rf $(SHLIB) $(OBJECTS) $(STATLIB) ./rust/.cargo ./rust/vendor ./rust/target
60-
61-
.PHONY: all C_clean clean
39+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) $(TARGET_DIR)

0 commit comments

Comments
 (0)