Skip to content

Commit

Permalink
--binary option replaces --nobinary and --onlybinary
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Doris committed Jul 2, 2022
1 parent b6752d0 commit d1aaa70
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,22 @@ python = ">=3.5,<4"
perl = ""

[deps.llvmlite]
# Long syntax to specify other fields, such as the channel
# Long syntax to specify other fields, such as the channel and build
version = ">=0.38,<0.39"
channel = "numba"
build = "*"

[pip.deps]
# Pip package names and versions
build = "~=0.7.0"
six = ""
some-remote-package = "@ https://example.com/foo.zip"
some-local-package = "@ ./foo.zip"

[pip.deps.nmslib]
# Long syntax to specify other fields
version = "~=2.1"
binary = "no" # or "only"
```

## Access the Conda environment
Expand Down Expand Up @@ -118,7 +124,7 @@ end

### Conda packages

These are identified by a name and version.
These are identified by a name, version and build.

The version must be a Conda version specifier, or be blank.

Expand All @@ -136,6 +142,9 @@ Direct references such as `foo @ http://example.com/foo.zip` are allowed. As a s
if the URL starts with `.` then it is interpreted as a path relative to the directory
containing the `CondaPkg.toml` file.

Additionally the binary mode specifies whether to only use binary distributions ("only") or
to never use them ("no").

### Backends

This package has a number of different "backends" which control exactly which implementation
Expand Down
28 changes: 7 additions & 21 deletions src/PkgREPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,10 @@ const force_opt = Pkg.REPLMode.OptionDeclaration([
:api => :force => true,
])

const only_binary_opt = Pkg.REPLMode.OptionDeclaration([
:name => "onlybinary",
:api => :only_binary => true,
])

const no_binary_opt = Pkg.REPLMode.OptionDeclaration([
:name => "nobinary",
:api => :no_binary => true,
const binary_opt = Pkg.REPLMode.OptionDeclaration([
:name => "binary",
:takes_arg => true,
:api => :binary => identity,
])

### status
Expand Down Expand Up @@ -164,23 +160,13 @@ const channel_add_spec = Pkg.REPLMode.CommandSpec(

### pip_add

function pip_add(args; only_binary=false, no_binary=false)
binary = ""
for (v, b) in [(only_binary, "only"), (no_binary, "no")]
if v
if binary == ""
binary = b
else
error("--$(binary)binary and --$(b)binary are mutually exclusive")
end
end
end
function pip_add(args; binary="")
CondaPkg.add([parse_pip_pkg(arg, binary=binary) for arg in args])
end

const pip_add_help = Markdown.parse("""
```
conda pip_add [--nobinary|--onlybinary] pkg ...
conda pip_add [--binary={only|no}] pkg ...
```
Add Pip packages to the environment.
Expand All @@ -200,7 +186,7 @@ const pip_add_spec = Pkg.REPLMode.CommandSpec(
help = pip_add_help,
description = "add Pip packages",
arg_count = 0 => Inf,
option_spec = [no_binary_opt, only_binary_opt],
option_spec = [binary_opt],
)

### rm
Expand Down

2 comments on commit d1aaa70

@cjdoris
Copy link
Collaborator

@cjdoris cjdoris commented on d1aaa70 Jul 2, 2022

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/63546

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.11 -m "<description of version>" d1aaa7056626ad24fc62e7a9190763b96cda947d
git push origin v0.2.11

Please sign in to comment.