Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to determine location of scripts/executables, and set directory where scripts/executable is run #125

Open
pcarbo opened this issue Apr 26, 2018 · 6 comments
Assignees

Comments

@pcarbo
Copy link
Member

pcarbo commented Apr 26, 2018

Suppose I do

cd ~
dsc /project/mstephens/gaow/dsc-fun/benchmark.dsc

Where does DSC look for the scripts? From which directory are the scripts run?

For guidance it might be helpful to look at argument knit_root_dir in rmarkdown::render because it has to deal with similar issues; see help(render) in R.

@gaow
Copy link
Member

gaow commented Apr 26, 2018

First let's discuss the expected behavior:

  1. working dir default: should it be current dir or the dir where one keeps DSC file? -- makes sense to use current dir.
  2. relative paths in DSC section: relative to working dir or to where DSC files are? -- makes sense to use folder where DSC file is at.

Note that for 1, I will always convert to use absolute path. But for 2 i'll have to keep it relative path because it will impact how scripts look like, and therefore trigger unnecessary reruns otherwise.

Once we are clear on this, the rest is just coding. As you can see it is more complex due to pipeline behavior, that we cannot just expand everything to use absolute paths. I'll find one peaceful weekend morning to port all path related strings in DSC code to use a formal Python path class (a variant of pathlib in Python 3.6 from SoS) that will resolve path related issues once and for all.

@pcarbo
Copy link
Member Author

pcarbo commented Apr 26, 2018

@gaow I agree it is important to come up to a consensus on this.

@gaow
Copy link
Member

gaow commented Apr 27, 2018

So @pcarbo you agree with my proposed behavior of 1 & 2 above?

@pcarbo
Copy link
Member Author

pcarbo commented Apr 27, 2018

@gaow Here is a problem with the proposal for 1: relative paths inside the code would only work correctly if the dsc command were run in a prespecified location, which would be very restrictive. On the other hand, if it were with respect to the DSC file or the source code, the dsc command could work anywhere.

@gaow
Copy link
Member

gaow commented Apr 27, 2018

Yes you are right. Okey now that we are clear about it i'll find some time to make changes to all path strings in the code.

@pcarbo
Copy link
Member Author

pcarbo commented Apr 27, 2018

When reporting relative paths we will also have to be careful to explain what these paths are relative to. (Or just report absolute paths.)

@gaow gaow self-assigned this Jun 27, 2018
@gaow gaow added the later label Jun 27, 2018
@gaow gaow added parser and removed later labels Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants