~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to doc/stdlib/pkg.rst

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-11-17 19:32:52 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20131117193252-tkrpclguqqebqa35
Tags: 0.2.0+dfsg-3
testsuite-i386.patch: loosen the numerical precision for yet another test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. module:: Base.Pkg
 
2
 
 
3
Package Manager Functions
 
4
-------------------------
 
5
 
 
6
All Package manager functions are defined in the ``Pkg`` module; note that none of the ``Pkg`` module's functions are exported;
 
7
to use them, you'll need to prefix each function call with an explicit ``Pkg.``, e.g. ``Pkg.status()`` or ``Pkg.dir()``.
 
8
 
 
9
.. function:: dir() -> String
 
10
 
 
11
   Returns the absolute path of the package directory.
 
12
   This defaults to ``joinpath(homedir(),".julia")`` on all platforms (i.e. ``~/.julia`` in UNIX shell syntax).
 
13
   If the ``JULIA_PKGDIR`` environment variable is set, that path is used instead.
 
14
   If ``JULIA_PKGDIR`` is a relative path, it is interpreted relative to whatever the current working directory is.
 
15
 
 
16
.. function:: dir(names...) -> String
 
17
 
 
18
   Equivalent to ``normpath(Pkg.dir(),names...)`` – i.e. it appends path components to the package directory and normalizes the resulting path.
 
19
   In particular, ``Pkg.dir(pkg)`` returns the path to the package ``pkg``.
 
20
 
 
21
.. function:: init()
 
22
 
 
23
   Initialize ``Pkg.dir()`` as a package directory.
 
24
   This will be done automatically when the ``JULIA_PKGDIR`` is not set and ``Pkg.dir()`` uses its default value.
 
25
 
 
26
.. function:: resolve()
 
27
 
 
28
   Determines an optimal, consistent set of package versions to install or upgrade to.
 
29
   The optimal set of package versions is based on the contents of ``Pkg.dir("REQUIRE")`` and the state of installed packages in ``Pkg.dir()``,
 
30
   Packages that are no longer required are moved into ``Pkg.dir(".trash")``.
 
31
 
 
32
.. function:: edit()
 
33
 
 
34
   Opens ``Pkg.dir("REQUIRE")`` in the editor specified by the ``VISUAL`` or ``EDITOR`` environment variables;
 
35
   when the editor command returns, it runs ``Pkg.resolve()`` to determine and install a new optimal set of installed package versions.
 
36
 
 
37
.. function:: add(pkg, vers...)
 
38
 
 
39
   Add a requirement entry for ``pkg`` to ``Pkg.dir("REQUIRE")`` and call ``Pkg.resolve()``.
 
40
   If ``vers`` are given, they must be ``VersionNumber`` objects and they specify acceptable version intervals for ``pkg``.
 
41
 
 
42
.. function:: rm(pkg)
 
43
 
 
44
   Remove all requirement entries for ``pkg`` from ``Pkg.dir("REQUIRE")`` and call ``Pkg.resolve()``.
 
45
 
 
46
.. function:: clone(url, [pkg])
 
47
 
 
48
   Clone a package directly from the git URL ``url``.
 
49
   The package does not need to be a registered in ``Pkg.dir("METADATA")``.
 
50
   The package repo is cloned by the name ``pkg`` if provided;
 
51
   if not provided, ``pkg`` is determined automatically from ``url``.
 
52
 
 
53
.. function:: clone(pkg)
 
54
 
 
55
   If ``pkg`` has a URL registered in ``Pkg.dir("METADATA")``, clone it from that URL on the default branch.
 
56
   The package does not need to have any registered versions.
 
57
 
 
58
.. function:: available() -> Vector{ASCIIString}
 
59
 
 
60
   Returns the names of available packages.
 
61
 
 
62
.. function:: available(pkg) -> Vector{VersionNumber}
 
63
 
 
64
   Returns the version numbers available for package ``pkg``.
 
65
 
 
66
.. function:: installed() -> Dict{ASCIIString,VersionNumber}
 
67
 
 
68
   Returns a dictionary mapping installed package names to the installed version number of each package.
 
69
 
 
70
.. function:: installed(pkg) -> Nothing | VersionNumber
 
71
 
 
72
   If ``pkg`` is installed, return the installed version number, otherwise return ``nothing``.
 
73
 
 
74
.. function:: status()
 
75
 
 
76
   Prints out a summary of what packages are installed and what version and state they're in.
 
77
 
 
78
.. function:: update()
 
79
 
 
80
   Update package the metadata repo – kept in ``Pkg.dir("METADATA")`` – then update any fixed packages that can safely be pulled from their origin;
 
81
   then call ``Pkg.resolve()`` to determine a new optimal set of packages versions.
 
82
 
 
83
.. function:: checkout(pkg, [branch="master"])
 
84
 
 
85
   Checkout the ``Pkg.dir(pkg)`` repo to the branch ``branch``.
 
86
   Defaults to checking out the "master" branch.
 
87
 
 
88
.. function:: pin(pkg)
 
89
 
 
90
   Pin ``pkg`` at the current version.
 
91
 
 
92
.. function:: pin(pkg, version)
 
93
 
 
94
   Pin ``pkg`` at registered version ``version``.
 
95
 
 
96
.. function:: free(pkg)
 
97
 
 
98
   Free the package ``pkg`` to be managed by the package manager again.
 
99
   It calls ``Pkg.resolve()`` to determine optimal package versions after.
 
100
   This is an inverse for both ``Pkg.checkout`` and ``Pkg.pin``.
 
101
 
 
102
.. function:: build()
 
103
 
 
104
   Run the build scripts for all installed packages in depth-first recursive order.
 
105
 
 
106
.. function:: build(pkgs...)
 
107
 
 
108
   Run the build scripts for each package in ``pkgs`` and all of their dependencies in depth-first recursive order.
 
109
   This is called automatically by ``Pkg.resolve()`` on all installed or updated packages.
 
110
 
 
111
.. function:: generate(pkg,license)
 
112
 
 
113
   Generate a new package named ``pkg`` with one of these license keys: ``"MIT"`` or ``"BSD"``.
 
114
   If you want to make a package with a different license, you can edit it afterwards.
 
115
   Generate creates a git repo at ``Pkg.dir(pkg)`` for the package and inside it ``LICENSE.md``, ``README.md``, the julia entrypoint ``$pkg/src/$pkg.jl``, and a travis test file, ``.travis.yml``.
 
116
 
 
117
.. function:: register(pkg, [url])
 
118
 
 
119
   Register ``pkg`` at the git URL ``url``, defaulting to the configured origin URL of the git repo ``Pkg.dir(pkg)``.
 
120
 
 
121
.. function:: tag(pkg, [ver, [commit]])
 
122
 
 
123
   Tag ``commit`` as version ``ver`` of package ``pkg`` and create a version entry in ``METADATA``.
 
124
   If not provided, ``commit`` defaults to the current commit of the ``pkg`` repo.
 
125
   If ``ver`` is one of the symbols ``:patch``, ``:minor``, ``:major`` the next patch, minor or major version is used.
 
126
   If ``ver`` is not provided, it defaults to ``:patch``.
 
127
 
 
128
.. function:: publish()
 
129
 
 
130
   For each new package version tagged in ``METADATA`` not already published, make sure that the tagged package commits have been pushed to the repo at the registered URL for the package and if they all have, push ``METADATA``.
 
131