Skip to content

Commit 53eea43

Browse files
authored
Merge branch 'master' into copilot/fix-36
2 parents 633877d + e3e6940 commit 53eea43

File tree

6 files changed

+98
-76
lines changed

6 files changed

+98
-76
lines changed

templates/script_templates/template.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ LocationOfThisScript = function() # Function LocationOfThisScript returns the lo
107107
if (identical(sys.function(i), base::source)) this.file = (normalizePath(sys.frame(i)$ofile))
108108
}
109109

110-
if (!is.null(this.file)) return(dirname(this.file))
111-
112-
# But it may also be called from the command line
113-
cmd.args = commandArgs(trailingOnly = FALSE)
114-
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
115-
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
116-
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
117-
118-
# If multiple --file arguments are given, R uses the last one
119-
res = tail(res[res != ""], 1)
120-
if (0 < length(res)) return(dirname(res))
121-
122-
# Both are not the case. Maybe we are in an R GUI?
123-
NULL
110+
if (!is.null(this.file)) {
111+
dirname(this.file)
112+
} else {
113+
# But it may also be called from the command line
114+
cmd.args = commandArgs(trailingOnly = FALSE)
115+
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
116+
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
117+
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
118+
119+
# If multiple --file arguments are given, R uses the last one
120+
res = tail(res[res != ""], 1)
121+
if (0 < length(res)) {
122+
dirname(res)
123+
} else {
124+
# Both are not the case. Maybe we are in an R GUI?
125+
NULL
126+
}
127+
}
124128
}
125129
Rscripts_dir <- LocationOfThisScript()
126130
print('Location where this script lives:')

templates/script_templates/template_clean.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ LocationOfThisScript = function() # Function LocationOfThisScript returns the lo
107107
if (identical(sys.function(i), base::source)) this.file = (normalizePath(sys.frame(i)$ofile))
108108
}
109109

110-
if (!is.null(this.file)) return(dirname(this.file))
111-
112-
# But it may also be called from the command line
113-
cmd.args = commandArgs(trailingOnly = FALSE)
114-
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
115-
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
116-
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
117-
118-
# If multiple --file arguments are given, R uses the last one
119-
res = tail(res[res != ""], 1)
120-
if (0 < length(res)) return(dirname(res))
121-
122-
# Both are not the case. Maybe we are in an R GUI?
123-
NULL
110+
if (!is.null(this.file)) {
111+
dirname(this.file)
112+
} else {
113+
# But it may also be called from the command line
114+
cmd.args = commandArgs(trailingOnly = FALSE)
115+
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
116+
cmd.args = cmd.args [seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
117+
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
118+
119+
# If multiple --file arguments are given, R uses the last one
120+
res = tail(res[res != ""], 1)
121+
if (0 < length(res)) {
122+
dirname(res)
123+
} else {
124+
# Both are not the case. Maybe we are in an R GUI?
125+
NULL
126+
}
127+
}
124128
}
125129
Rscripts_dir <- LocationOfThisScript()
126130
print('Location where this script lives:')

tests/ref_files/pq_example/code/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Base image
99
############
1010

11-
FROM continuumio/miniconda3
11+
FROM continuumio/miniconda3:25.3.1-1
1212
# It runs on Debian GNU/Linux 8; use e.g. uname -a ; cat /etc/issue.net
1313
# https://hub.docker.com/r/continuumio/miniconda/
1414
# Or simply run:
@@ -27,22 +27,24 @@ LABEL maintainer="author_name <author_email>"
2727

2828
# Install system dependencies
2929
# If running on Debian and anaconda/miniconda image, use apt-get:
30-
RUN apt-get update && apt-get upgrade -qy apt-utils
30+
RUN apt-get update && apt-get upgrade -qy --no-install-recommends apt-utils
3131

32-
RUN apt-get install -qy gcc \
32+
RUN apt-get install -qy --no-install-recommends gcc \
3333
g++ \
3434
tzdata \
3535
wget \
3636
bzip2 \
3737
unzip \
3838
sudo \
3939
bash \
40-
fixincludes
40+
fixincludes \
41+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
4142

4243
# Get plotting libraries:
43-
RUN apt-get install -qy \
44+
RUN apt-get install -qy --no-install-recommends \
4445
inkscape \
45-
graphviz
46+
graphviz \
47+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
4648

4749
#########################
4850
# Install conda

tests/ref_files/pq_test_ref.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ LocationOfThisScript = function() # Function LocationOfThisScript returns the lo
107107
if (identical(sys.function(i), base::source)) this.file = (normalizePath(sys.frame(i)$ofile))
108108
}
109109

110-
if (!is.null(this.file)) return(dirname(this.file))
111-
112-
# But it may also be called from the command line
113-
cmd.args = commandArgs(trailingOnly = FALSE)
114-
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
115-
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
116-
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
117-
118-
# If multiple --file arguments are given, R uses the last one
119-
res = tail(res[res != ""], 1)
120-
if (0 < length(res)) return(dirname(res))
121-
122-
# Both are not the case. Maybe we are in an R GUI?
123-
NULL
110+
if (!is.null(this.file)) {
111+
dirname(this.file)
112+
} else {
113+
# But it may also be called from the command line
114+
cmd.args = commandArgs(trailingOnly = FALSE)
115+
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
116+
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
117+
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
118+
119+
# If multiple --file arguments are given, R uses the last one
120+
res = tail(res[res != ""], 1)
121+
if (0 < length(res)) {
122+
dirname(res)
123+
} else {
124+
# Both are not the case. Maybe we are in an R GUI?
125+
NULL
126+
}
127+
}
124128
}
125129
Rscripts_dir <- LocationOfThisScript()
126130
print('Location where this script lives:')

tests/ref_files/pq_test_ref/code/pq_test_ref/pq_test_ref.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ LocationOfThisScript = function() # Function LocationOfThisScript returns the lo
107107
if (identical(sys.function(i), base::source)) this.file = (normalizePath(sys.frame(i)$ofile))
108108
}
109109

110-
if (!is.null(this.file)) return(dirname(this.file))
111-
112-
# But it may also be called from the command line
113-
cmd.args = commandArgs(trailingOnly = FALSE)
114-
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
115-
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
116-
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
117-
118-
# If multiple --file arguments are given, R uses the last one
119-
res = tail(res[res != ""], 1)
120-
if (0 < length(res)) return(dirname(res))
121-
122-
# Both are not the case. Maybe we are in an R GUI?
123-
NULL
110+
if (!is.null(this.file)) {
111+
dirname(this.file)
112+
} else {
113+
# But it may also be called from the command line
114+
cmd.args = commandArgs(trailingOnly = FALSE)
115+
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
116+
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
117+
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
118+
119+
# If multiple --file arguments are given, R uses the last one
120+
res = tail(res[res != ""], 1)
121+
if (0 < length(res)) {
122+
dirname(res)
123+
} else {
124+
# Both are not the case. Maybe we are in an R GUI?
125+
NULL
126+
}
127+
}
124128
}
125129
Rscripts_dir <- LocationOfThisScript()
126130
print('Location where this script lives:')

tests/ref_files/pq_test_ref/code/pq_test_ref/pq_test_ref_clean.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,24 @@ LocationOfThisScript = function() # Function LocationOfThisScript returns the lo
107107
if (identical(sys.function(i), base::source)) this.file = (normalizePath(sys.frame(i)$ofile))
108108
}
109109

110-
if (!is.null(this.file)) return(dirname(this.file))
111-
112-
# But it may also be called from the command line
113-
cmd.args = commandArgs(trailingOnly = FALSE)
114-
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
115-
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
116-
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
117-
118-
# If multiple --file arguments are given, R uses the last one
119-
res = tail(res[res != ""], 1)
120-
if (0 < length(res)) return(dirname(res))
121-
122-
# Both are not the case. Maybe we are in an R GUI?
123-
NULL
110+
if (!is.null(this.file)) {
111+
dirname(this.file)
112+
} else {
113+
# But it may also be called from the command line
114+
cmd.args = commandArgs(trailingOnly = FALSE)
115+
cmd.args.trailing = commandArgs(trailingOnly = TRUE)
116+
cmd.args = cmd.args[seq.int(from = 1, length.out = length(cmd.args) - length(cmd.args.trailing))]
117+
res = gsub("^(?:--file=(.*)|.*)$", "\\1", cmd.args)
118+
119+
# If multiple --file arguments are given, R uses the last one
120+
res = tail(res[res != ""], 1)
121+
if (0 < length(res)) {
122+
dirname(res)
123+
} else {
124+
# Both are not the case. Maybe we are in an R GUI?
125+
NULL
126+
}
127+
}
124128
}
125129
Rscripts_dir <- LocationOfThisScript()
126130
print('Location where this script lives:')

0 commit comments

Comments
 (0)