From 1112b3d0ba23ae5fe91526c92c9e4b269fa1c57c Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 20 Apr 2021 23:36:55 +0100 Subject: [PATCH 1/2] add support for chia installed via macOS dmg installer The official macOS dmg installation makes `chia` available as a standalone binary. That means the `cmdline` does not include `python` in the first position. This commit updates the cmdline parsing logic to allow for `chia` binaries like this. --- README.md | 9 ++++++--- src/plotman/job.py | 22 ++++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b298e7ca..3216f800 100644 --- a/README.md +++ b/README.md @@ -181,11 +181,14 @@ To display the current location of your `plotman.yaml` file and check if it exis ## Installation -Installation for Linux: +Installation for Linux and macOS: 1. Plotman assumes that a functioning [Chia](https://github.com/Chia-Network/chia-blockchain) - installation is present on the system. Activate your `chia` environment by typing - `source /path/to/your/chia/install/activate`. + installation is present on the system. + - Linux: Activate your `chia` environment by typing + `source /path/to/your/chia/install/activate`. + - macOS: Follow [these instructions](https://github.com/Chia-Network/chia-blockchain/wiki/CLI-Commands-Reference#mac) + to add the `chia` binary to the PATH 2. Then, install Plotman using the following command: ```shell > pip install --force-reinstall git+https://github.com/ericaltendorf/plotman@main diff --git a/src/plotman/job.py b/src/plotman/job.py index 6314d168..2d8d01f6 100644 --- a/src/plotman/job.py +++ b/src/plotman/job.py @@ -25,12 +25,13 @@ def job_phases_for_dstdir(d, all_jobs): return sorted([j.progress() for j in all_jobs if j.dstdir == d]) def is_plotting_cmdline(cmdline): + if cmdline and 'python' in cmdline[0]: + cmdline = cmdline[1:] return ( - len(cmdline) >= 4 - and 'python' in cmdline[0] - and cmdline[1].endswith('/chia') - and 'plots' == cmdline[2] - and 'create' == cmdline[3] + len(cmdline) >= 3 + and cmdline[0].endswith("chia") + and 'plots' == cmdline[1] + and 'create' == cmdline[2] ) # This is a cmdline argument fix for https://github.com/ericaltendorf/plotman/issues/41 @@ -105,12 +106,13 @@ def __init__(self, proc, logroot): with self.proc.oneshot(): # Parse command line args args = self.proc.cmdline() + if 'python' in args[0]: + args = args[1:] assert len(args) > 4 - assert 'python' in args[0] - assert 'chia' in args[1] - assert 'plots' == args[2] - assert 'create' == args[3] - args_iter = iter(cmdline_argfix(args[4:])) + assert 'chia' in args[0] + assert 'plots' == args[1] + assert 'create' == args[2] + args_iter = iter(cmdline_argfix(args[3:])) for arg in args_iter: val = None if arg in {'-e', '--nobitfield', '-h', '--help', '--override-k'} else next(args_iter) if arg in {'-k', '--size'}: From 7229b43a8818936f528daf59adda845ffe02eea3 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 22 Apr 2021 10:01:02 +0100 Subject: [PATCH 2/2] Update README.md Co-authored-by: Kyle Altendorf --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3216f800..b53e4244 100644 --- a/README.md +++ b/README.md @@ -185,10 +185,10 @@ Installation for Linux and macOS: 1. Plotman assumes that a functioning [Chia](https://github.com/Chia-Network/chia-blockchain) installation is present on the system. - - Linux: Activate your `chia` environment by typing + - virtual environment (Linux, macOS): Activate your `chia` environment by typing `source /path/to/your/chia/install/activate`. - - macOS: Follow [these instructions](https://github.com/Chia-Network/chia-blockchain/wiki/CLI-Commands-Reference#mac) - to add the `chia` binary to the PATH + - dmg (macOS): Follow [these instructions](https://github.com/Chia-Network/chia-blockchain/wiki/CLI-Commands-Reference#mac) + to add the `chia` binary to the `PATH` 2. Then, install Plotman using the following command: ```shell > pip install --force-reinstall git+https://github.com/ericaltendorf/plotman@main