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

Respect startup-file flag in Pkg.build and Pkg.test #22094

Merged
merged 2 commits into from
Jun 9, 2017
Merged

Conversation

omus
Copy link
Member

@omus omus commented May 27, 2017

Fixes #21823 since Pkg.update calls Pkg.build

@kshyatt kshyatt added the packages Package management and loading label May 27, 2017
@tkelman
Copy link
Contributor

tkelman commented May 27, 2017

probably worth adding a startup_file kwarg so you could turn this back on if you wanted (defaulting to off is better though)

Copy link
Contributor

@yuyichao yuyichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not fix #21823 since it still doesn't "respect --startup-file=no" .

@omus
Copy link
Member Author

omus commented May 29, 2017

I'll add @tkelman's suggestion to support loading the startup file through a keyword.

@omus
Copy link
Member Author

omus commented May 29, 2017

After thinking about it more I think think we shouldn't support a startup_file keyword. I don't think either Pkg.test or Pkg.build should depend on anything within the startup file since this would be a requirement which is not properly tracked by the package. Additionally, having the startup_file keyword exposes that both Pkg.test and Pkg.build are launching new Julia processes which may not be true in the future.

@omus
Copy link
Member Author

omus commented May 29, 2017

This does not fix #21823 since it still doesn't "respect --startup-file=no" .

Although the title of the issue wants Pkg.update to respect the startup-file flag all the OP is asking for is that his startup-file is not loaded during Pkg.update. I don't think there is a good use case for loading the startup-file here.

@tkelman
Copy link
Contributor

tkelman commented May 29, 2017

I'm thinking about deployments in unusual environments that may be using juliarc to set up custom library paths, that kind of thing. I wouldn't think it would be a commonly used flag, but I don't see an issue with exposing that separate processes are getting launched. If that changes we can deprecate the keyword arguments - we already have one for code coverage which is a similar situation.

@omus
Copy link
Member Author

omus commented May 29, 2017

I'm thinking about deployments in unusual environments that may be using juliarc to set up custom library paths, that kind of thing.

A good point. Since several Pkg functions eventually call Pkg.build (like Pkg.update) we would also need to have the keyword available for those functions as well.

It seems that the easiest solution would be to just respect the --startup-file flag from the parent Julia process. Unfortunately this means the default will be to load the startup-file but at least users will have the option to disable it.

@omus omus force-pushed the cv/pkg-startup branch from 7e33bd9 to 582662c Compare May 29, 2017 14:41
@omus omus changed the title Disable loading .juliarc.jl for Pkg.build and Pkg.test Respect startup-file flag in Pkg.build and Pkg.test May 29, 2017
@omus
Copy link
Member Author

omus commented May 29, 2017

The JLOptions().startupfile uses 0 for unset, 1 for "yes", and 2 for "off".

@omus omus force-pushed the cv/pkg-startup branch from 582662c to d85bed4 Compare May 29, 2017 22:03
@tkelman
Copy link
Contributor

tkelman commented May 30, 2017

This version seems like an improvement over what we've got now at least (and would make a little more sense to consider backporting even, as opposed to new keyword args). Could use a test though.

@omus
Copy link
Member Author

omus commented May 30, 2017

Could use a test though.

Is it safe to temporarily modify abspath(JULIA_HOME,"..","etc","julia","juliarc.jl") for a test?

@tkelman
Copy link
Contributor

tkelman commented May 30, 2017

could set HOME in a withenv ?

@@ -719,7 +720,7 @@ function test!(pkg::AbstractString,
--compilecache=$(Bool(Base.JLOptions().use_compilecache) ? "yes" : "no")
--check-bounds=yes
--startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no")
$test_path
--eval $code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change necessary?

Copy link
Member Author

@omus omus Jun 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly necessary but evalfile does make the "runtests.jl" file run inside of a module which means variables defined within the startup-file can only be accessed via Main.*. I made this modification to make it harder to accidentally reference a variable within the tests which was defined or imported by the startup-file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that did necessitate the messy escape_string business though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is running the runtests.jl inside a module via evalfile going to result in any packages' tests behaving differently?

@omus omus force-pushed the cv/pkg-startup branch from 7c63665 to ba325ed Compare June 5, 2017 14:30
@tkelman
Copy link
Contributor

tkelman commented Jun 5, 2017

the appveyor timeouts look like redirection to a file was necessary

@omus
Copy link
Member Author

omus commented Jun 6, 2017

could set HOME in a withenv?

Looks like for Windows you need to set USERPROFILE.

@omus omus force-pushed the cv/pkg-startup branch 2 times, most recently from 33bb3ce to 6785184 Compare June 6, 2017 19:36
@omus
Copy link
Member Author

omus commented Jun 6, 2017

I'll try to sort out the issues tomorrow

@yuyichao yuyichao dismissed their stale review June 7, 2017 01:33

Issue fixed.

Flags given to subprocesses are now alphabetized.
@omus omus force-pushed the cv/pkg-startup branch 2 times, most recently from 605c4d3 to e235353 Compare June 7, 2017 20:30
@omus
Copy link
Member Author

omus commented Jun 7, 2017

Resolved the following issues:

  • Needed to use escape_string in Pkg.test to work correctly with Windows paths
  • isdefined(::Symbol) was deprecated which caused my tests to fail on Linux and Mac due to starting julia with --depwarn=error

@omus
Copy link
Member Author

omus commented Jun 8, 2017

Ready to merge

@omus
Copy link
Member Author

omus commented Jun 9, 2017

I'll merge this today unless there are objections. I need to close one of the 1800 issues ;)

@tkelman
Copy link
Contributor

tkelman commented Jun 9, 2017

had a now-collapsed question on the change to using evalfile

is running the runtests.jl inside a module via evalfile going to result in any packages' tests behaving differently?

I guess we'll find out, but I'm a bit concerned if packages will notice the change.

@omus
Copy link
Member Author

omus commented Jun 9, 2017

is running the runtests.jl inside a module via evalfile going to result in any packages' tests behaving differently?

Packages which assume the tests are running in the Main module could break. For example Compat.jl will run require two changes in runtests.jl lines 1570 and 1855. I'll make a Compat.jl PR.

@omus
Copy link
Member Author

omus commented Jun 9, 2017

I'll make a NEWS entry to make debugging this change easier.

@tkelman
Copy link
Contributor

tkelman commented Jun 9, 2017

In that case I don't personally think this (edit: just the evalfile part) behavior change to Pkg.test is worth the disruption - CI will virtually never have a juliarc, after all.

@iamed2
Copy link
Contributor

iamed2 commented Jun 9, 2017

@tkelman Are you referring to just the evalfile part?

@iamed2
Copy link
Contributor

iamed2 commented Jun 9, 2017

Package tests really shouldn't be assuming Main, especially since current_module()/@__MODULE__ is available.

@tkelman
Copy link
Contributor

tkelman commented Jun 9, 2017

Are you referring to just the evalfile part?

Right, the change in which module things run in (the --startup-file part is worth doing). Package tests have been run in the existing way for as long as Pkg.test has existed, and tweaking the module doesn't seem to be accomplishing much of anything aside from this minor point about juliarc isolation.

@omus
Copy link
Member Author

omus commented Jun 9, 2017

I'd like to get the juliarc isolation included but I can accept that it is a controversial change. I'll remove that change from this PR so the remainder of the changes can at least be merged.

@tkelman
Copy link
Contributor

tkelman commented Jun 9, 2017

Sorry, yes, propagating --startup-file is a definite improvement and not disruptive, but is independent of whether or not Pkg.test runs code via evalfile

@omus omus force-pushed the cv/pkg-startup branch from dac0d80 to 93b7ca5 Compare June 9, 2017 19:34
@tkelman
Copy link
Contributor

tkelman commented Jun 9, 2017

LGTM now, though the NEWS bit should move to where the evalfile change goes

@omus
Copy link
Member Author

omus commented Jun 9, 2017

LGTM now, though the NEWS bit should move to where the evalfile change goes

Thanks. I just noticed that myself.

@omus omus force-pushed the cv/pkg-startup branch from 93b7ca5 to 4f127f4 Compare June 9, 2017 19:43
Copy link
Contributor

@tkelman tkelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to merge if CI is green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages Package management and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants