Skip to content

Instantly share code, notes, and snippets.

@pwwang
Last active April 14, 2023 18:52
Show Gist options
  • Save pwwang/6b01ce7942d80ea619a524711600b0a7 to your computer and use it in GitHub Desktop.
Save pwwang/6b01ce7942d80ea619a524711600b0a7 to your computer and use it in GitHub Desktop.

Revisions

  1. pwwang revised this gist Apr 14, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions poetry-editable.fish
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@ function poetry-editable --description 'Do editable install for poetry project'
    echo "= RUN poetry build"
    poetry build
    set ver (poetry version -s)
    cd dist/
    pushd dist/
    tar zxvf *-$ver.tar.gz
    cd ..
    popd
    mv setup.py setup.py.bak

    function on_premature_exit
  2. pwwang revised this gist Apr 14, 2023. 1 changed file with 14 additions and 5 deletions.
    19 changes: 14 additions & 5 deletions poetry-editable.fish
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    # Defined in - @ line 0
    function poetry-editable --description "Do 'pip install -e' for poetry project"
    function poetry-editable --description 'Do editable install for poetry project'
    echo "= RUN poetry build"
    poetry build
    set ver (poetry version -s)
    @@ -8,17 +7,27 @@ function poetry-editable --description "Do 'pip install -e' for poetry project"
    cd ..
    mv setup.py setup.py.bak

    function on_premature_exit
    functions -e on_premature_exit
    echo "= RESTORE setup.py"
    mv setup.py.bak setup.py
    end

    echo "= PREPARE setup.py"
    ln -s dist/*-$ver/setup.py
    if test $status -ne 0
    on_premature_exit
    return 1
    end

    echo "= RUN pip install"
    python setup.py develop 2> /tmp/pip-editable
    if test $status -ne 0
    on_premature_exit
    echo " FAILED. Check full log at /tmp/pip-editable"
    tail /tmp/pip-editable
    return 1
    end

    echo "= GET original setup.py back"
    mv setup.py.bak setup.py
    end
    on_premature_exit
    end
  3. pwwang revised this gist May 3, 2022. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions poetry-editable.fish
    Original file line number Diff line number Diff line change
    @@ -12,17 +12,13 @@ function poetry-editable --description "Do 'pip install -e' for poetry project"
    ln -s dist/*-$ver/setup.py

    echo "= RUN pip install"
    pip install -U -e . 2> /tmp/pip-editable
    python setup.py develop 2> /tmp/pip-editable
    if test $status -ne 0
    echo " FAILED. Check full log at /tmp/pip-editable"
    tail /tmp/pip-editable
    return 1
    end

    echo "= FIX pip install running"
    set cmd (cat /tmp/pip-editable | grep command: | string sub -s 15)
    eval $cmd

    echo "= GET original setup.py back"
    mv setup.py.bak setup.py
    end
  4. pwwang revised this gist May 3, 2022. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion poetry-editable.fish
    Original file line number Diff line number Diff line change
    @@ -13,11 +13,16 @@ function poetry-editable --description "Do 'pip install -e' for poetry project"

    echo "= RUN pip install"
    pip install -U -e . 2> /tmp/pip-editable
    if test $status -ne 0
    echo " FAILED. Check full log at /tmp/pip-editable"
    tail /tmp/pip-editable
    return 1
    end

    echo "= FIX pip install running"
    set cmd (cat /tmp/pip-editable | grep command: | string sub -s 15)
    eval $cmd

    echo "= GET original setup.py back"
    mv setup.py.bak setup.py
    end
    end
  5. pwwang created this gist Oct 21, 2021.
    23 changes: 23 additions & 0 deletions poetry-editable.fish
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # Defined in - @ line 0
    function poetry-editable --description "Do 'pip install -e' for poetry project"
    echo "= RUN poetry build"
    poetry build
    set ver (poetry version -s)
    cd dist/
    tar zxvf *-$ver.tar.gz
    cd ..
    mv setup.py setup.py.bak

    echo "= PREPARE setup.py"
    ln -s dist/*-$ver/setup.py

    echo "= RUN pip install"
    pip install -U -e . 2> /tmp/pip-editable

    echo "= FIX pip install running"
    set cmd (cat /tmp/pip-editable | grep command: | string sub -s 15)
    eval $cmd

    echo "= GET original setup.py back"
    mv setup.py.bak setup.py
    end