Skip to content

Commit

Permalink
move Pkg to stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jan 30, 2018
1 parent 3dd40ff commit ca65ee9
Show file tree
Hide file tree
Showing 44 changed files with 161 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
/tmp/julia/bin/julia-debug --sysimage-native-code=no -e 'true' &&
pushd /tmp/julia/share/julia/test &&
/tmp/julia/bin/julia --check-bounds=yes runtests.jl all --skip socket | bar -i 30 &&
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online download pkg &&
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online Pkg/pkg download &&
popd &&
mkdir /tmp/embedding-test &&
make check -C /tmp/julia/share/doc/julia/examples/embedding \
Expand Down
6 changes: 2 additions & 4 deletions .freebsdci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ runtests(){
export JULIA_TEST_MAXRSS_MB=600
export JULIA_CPU_CORES=$MAKE_JOBS_NUMBER

gmake testall \
test-download \
test-pkg \
test-libgit2-online
./usr/bin/julia test/runtests.jl all
./usr/bin/julia test/runtests.jl libgit2-online Pkg/pkg download
}

test-embedding(){
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ script:
- /tmp/julia/bin/julia -e 'versioninfo()'
- pushd /tmp/julia/share/julia/test
- /tmp/julia/bin/julia --check-bounds=yes runtests.jl $TESTSTORUN &&
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online download pkg
/tmp/julia/bin/julia --check-bounds=yes runtests.jl libgit2-online Pkg/pkg download
- popd
# test that the embedding code works on our installation
- mkdir /tmp/embedding-test &&
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ test_script:
- usr\bin\julia -e "versioninfo()"
- usr\bin\julia --sysimage-native-code=no -e "true"
- cd julia-* && .\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl all &&
.\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl libgit2-online download pkg
.\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl libgit2-online Pkg/pkg download
- cd ..
- usr\bin\julia usr\share\doc\julia\examples\embedding\embedding-test.jl examples\embedding\embedding.exe
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
export
# Modules
Meta,
Pkg,
LibGit2,
StackTraces,
Sys,
Expand Down
1 change: 0 additions & 1 deletion base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function init_load_path(BINDIR = Sys.BINDIR)
load_path = get(ENV, "JULIA_LOAD_PATH", "@|@v#.#.#|@v#.#|@v#|@default|@!v#.#")
append!(empty!(LOAD_PATH), parse_load_path(load_path))
vers = "v$(VERSION.major).$(VERSION.minor)"
push!(LOAD_PATH, Pkg.dir)
push!(LOAD_PATH, abspath(BINDIR, "..", "local", "share", "julia", "site", vers))
push!(LOAD_PATH, abspath(BINDIR, "..", "share", "julia", "site", vers))
end
Expand Down
1 change: 1 addition & 0 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ function create_expr_cache(input::String, output::String, concrete_deps::typeof(
try
write(in, """
begin
import Pkg
empty!(Base.LOAD_PATH)
append!(Base.LOAD_PATH, $(repr(LOAD_PATH, :module => nothing)))
empty!(Base.DEPOT_PATH)
Expand Down
2 changes: 0 additions & 2 deletions base/precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ precompile(Tuple{typeof(Base.show_method_params), Base.GenericIOBuffer{Array{UIn
precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Module})
precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Symbol, String, Int32})
precompile(Tuple{typeof(Base.reverseind), String, Int64})
precompile(Tuple{typeof(Base.Pkg.Dir.path)})
precompile(Tuple{typeof(Base.promote_type), Type{String}, Type{Union{}}})
precompile(Tuple{typeof(Base.promote_type), Type{Any}, Type{String}})
precompile(Tuple{typeof(Base.promote_rule), Type{Any}, Type{String}})
Expand Down Expand Up @@ -597,7 +596,6 @@ precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Stri
precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, DataType, Char})
precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, typeof(Type), Char})
precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Module, String, Char})
precompile(Tuple{typeof(Base.Pkg.dir), String, String})
precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Array{Base.Docs.DocStr, 1}, Symbol, Int64})
precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Base.Docs.Binding, Symbol, Int64})
precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Type{Union{}}, Symbol, Int64})
Expand Down
4 changes: 2 additions & 2 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Get the fully-qualified name of a module as a tuple of symbols. For example,
# Examples
```jldoctest
julia> fullname(Base.Pkg)
(:Base, :Pkg)
julia> fullname(Base.Iterators)
(:Base, :Iterators)
julia> fullname(Main)
(:Main,)
Expand Down
6 changes: 3 additions & 3 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,6 @@ include("missing.jl")
# libgit2 support
include("libgit2/libgit2.jl")

# package manager
include("pkg/pkg.jl")

# worker threads
include("threadcall.jl")

Expand Down Expand Up @@ -525,6 +522,7 @@ Base.require(Base, :SparseArrays)
Base.require(Base, :SuiteSparse)
Base.require(Base, :Test)
Base.require(Base, :Unicode)
Base.require(Base, :Pkg)
Base.require(Base, :REPL)
Base.require(Base, :Markdown)

Expand Down Expand Up @@ -566,6 +564,8 @@ Base.require(Base, :Markdown)
@deprecate_binding REPLCompletions root_module(Base, :REPL).REPLCompletions true ", use `REPL.REPLCompletions` instead"
@deprecate_binding Terminals root_module(Base, :REPL).Terminals true ", use `REPL.Terminals` instead"

@deprecate_binding Pkg root_module(Base, :Pkg) true ", run `using Pkg` instead"

@eval @deprecate_binding $(Symbol("@doc_str")) getfield(root_module(Base, :Markdown), Symbol("@doc_str")) true ", use `Markdown` instead"

@deprecate_stdlib readdlm DelimitedFiles true
Expand Down
2 changes: 1 addition & 1 deletion doc/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Install dependencies needed to build the documentation.
ENV["JULIA_PKGDIR"] = joinpath(@__DIR__, "deps")
using Pkg
Pkg.init()
cp(joinpath(@__DIR__, "REQUIRE"), Pkg.dir("REQUIRE"); remove_destination = true)
Pkg.update()
Expand Down Expand Up @@ -101,7 +102,6 @@ const PAGES = [
"base/io-network.md",
"base/punctuation.md",
"base/sort.md",
"base/pkg.md",
"base/iterators.md",
"base/c.md",
"base/libc.md",
Expand Down
1 change: 0 additions & 1 deletion doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Base.Iterators
Base.LibGit2
Base.Libc
Base.Meta
Base.Pkg
Base.StackTraces
Base.Sys
Base.Threads
Expand Down
4 changes: 2 additions & 2 deletions doc/src/manual/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Julia has a built-in package manager for installing add-on functionality written in Julia. It
can also install external libraries using your operating system's standard system for doing so,
or by compiling from source. The list of registered Julia packages can be found at [https://pkg.julialang.org](https://pkg.julialang.org).
All package manager commands are found in the `Pkg` module, included in Julia's `Base`
install.
All package manager commands are found in the `Pkg` standard library which becomes available after using
`import Pkg`.

First we'll go over the mechanics of the `Pkg` family of commands and then we'll provide some
guidance on how to get your package registered. Be sure to read the section below on package naming
Expand Down
1 change: 1 addition & 0 deletions stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using Base: unwrap_unionall, rewrap_unionall, isdeprecated, Bottom, show_expr_ty
to_tuple_type, signature_type, format_bytes

using Markdown
import Pkg

include("editless.jl")
include("codeview.jl")
Expand Down
1 change: 1 addition & 0 deletions stdlib/Markdown/src/Markdown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Tools for working with the Markdown file format. Mainly for documentation.
"""
module Markdown

import Pkg
import Base: show, ==, with_output_color

include(joinpath("parse", "config.jl"))
Expand Down
36 changes: 18 additions & 18 deletions doc/src/base/pkg.md → stdlib/Pkg/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ package. See [PkgDev README](https://github.com/JuliaLang/PkgDev.jl/blob/master/
the documentation of those functions.

```@docs
Base.Pkg.dir
Base.Pkg.init
Base.Pkg.resolve
Base.Pkg.edit
Base.Pkg.add
Base.Pkg.rm
Base.Pkg.clone
Base.Pkg.setprotocol!
Base.Pkg.available
Base.Pkg.installed
Base.Pkg.status
Base.Pkg.update
Base.Pkg.checkout
Base.Pkg.pin
Base.Pkg.free
Base.Pkg.build
Base.Pkg.test
Base.Pkg.dependents
Pkg.dir
Pkg.init
Pkg.resolve
Pkg.edit
Pkg.add
Pkg.rm
Pkg.clone
Pkg.setprotocol!
Pkg.available
Pkg.installed
Pkg.status
Pkg.update
Pkg.checkout
Pkg.pin
Pkg.free
Pkg.build
Pkg.test
Pkg.dependents
```
2 changes: 1 addition & 1 deletion base/pkg/pkg.jl → stdlib/Pkg/src/Pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ init(meta::AbstractString=DEFAULT_META, branch::AbstractString=META_BRANCH) = Di

function __init__()
vers = "v$(VERSION.major).$(VERSION.minor)"
pushfirst!(Base.LOAD_PATH, dir)
pushfirst!(Base.LOAD_CACHE_PATH, abspath(Dir._pkgroot(), "lib", vers))
end

Expand Down Expand Up @@ -288,7 +289,6 @@ Set the protocol used to access GitHub-hosted packages. Defaults to 'https', wit
"""
setprotocol!(proto::AbstractString) = Cache.setprotocol!(proto)


# point users to PkgDev
register(args...) =
error("Pkg.register(pkg,[url]) has been moved to the package PkgDev.jl.\n",
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/cache.jl → stdlib/Pkg/src/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module Cache

import ...LibGit2, ..Dir, ...Pkg.PkgError
import Pkg
import ...LibGit2, ..Dir, ..PkgError
using ..Types

rewrite_url_to = "https"
Expand Down
4 changes: 2 additions & 2 deletions base/pkg/dir.jl → stdlib/Pkg/src/dir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

module Dir

import ..Pkg: DEFAULT_META, META_BRANCH, PkgError
import Pkg
import ..DEFAULT_META, ..META_BRANCH, ..PkgError
import ...LibGit2, ...LibGit2.with

const DIR_NAME = ".julia"

_pkgroot() = abspath(get(ENV,"JULIA_PKGDIR",joinpath(homedir(),DIR_NAME)))
Expand Down
4 changes: 3 additions & 1 deletion base/pkg/entry.jl → stdlib/Pkg/src/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
module Entry

import Base: thispatch, nextpatch, nextminor, nextmajor, check_new_version
import Pkg
import ..Reqs, ..Read, ..Query, ..Resolve, ..Cache, ..Write, ..Dir
using ...LibGit2
import ...Pkg.PkgError
import ..PkgError
using ..Types
using Base.Printf: @printf

Expand Down Expand Up @@ -582,6 +583,7 @@ function build(pkg::AbstractString, build_file::AbstractString, errfile::Abstrac
# To isolate the build from the running Julia process, we execute each build.jl file in
# a separate process. Errors are written to errfile for later reporting.
code = """
import Pkg
empty!(Base.LOAD_PATH)
append!(Base.LOAD_PATH, $(repr(LOAD_PATH, :module => nothing)))
empty!(Base.DEPOT_PATH)
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/query.jl → stdlib/Pkg/src/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module Query

import ...Pkg.PkgError
import Pkg
import ..PkgError
using ..Types

function init_resolve_backtrace(reqs::Requires, fix::Dict{String,Fixed} = Dict{String,Fixed}())
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/read.jl → stdlib/Pkg/src/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module Read

import ...LibGit2, ..Cache, ..Reqs, ...Pkg.PkgError, ..Dir
import Pkg
import ...LibGit2, ..Cache, ..Reqs, ..PkgError, ..Dir
using ..Types

readstrip(path...) = strip(read(joinpath(path...), String))
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/reqs.jl → stdlib/Pkg/src/reqs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
module Reqs

import Base: ==
import ...Pkg.PkgError
import Pkg
import ..PkgError
using ..Types

# representing lines of REQUIRE files
Expand Down
4 changes: 3 additions & 1 deletion base/pkg/resolve.jl → stdlib/Pkg/src/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

module Resolve

import Pkg

include(joinpath("resolve", "versionweight.jl"))
include(joinpath("resolve", "interface.jl"))
include(joinpath("resolve", "maxsum.jl"))

using ..Types, ..Query, .PkgToMaxSumInterface, .MaxSum
import ...Pkg.PkgError
import ..PkgError

export resolve, sanity_check

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions base/pkg/types.jl → stdlib/Pkg/src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module Types

import Pkg

export VersionInterval, VersionSet, Requires, Available, Fixed, merge_requires!, satisfies,
ResolveBacktraceItem, ResolveBacktrace
import Base: show, isempty, in, intersect, union!, union, ==, hash, copy, deepcopy_internal, push!
Expand Down
3 changes: 2 additions & 1 deletion base/pkg/write.jl → stdlib/Pkg/src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

module Write

import ..Cache, ..Read, ...Pkg.PkgError
import Pkg
import ..Cache, ..Read, ..PkgError
using ...LibGit2

function prefetch(pkg::AbstractString, sha1::AbstractString)
Expand Down
Loading

0 comments on commit ca65ee9

Please sign in to comment.