Skip to content

Commit

Permalink
Switch to Poetry (#55)
Browse files Browse the repository at this point in the history
* switch to poetry

* version changes

* add pypi push
  • Loading branch information
itsnebulalol authored Jul 28, 2022
1 parent 5c11c35 commit 6cad622
Show file tree
Hide file tree
Showing 8 changed files with 449 additions and 29 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/docker.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Push to Docker Hub
name: Publish Package

on:
release:
types: [published]

workflow_dispatch:

jobs:
Expand All @@ -22,9 +25,18 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
- name: Build and push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: itsnebulalol/permasigner:latest
tags: itsnebulalol/permasigner:latest

- name: Build and publish to PyPi
uses: JRubics/poetry-publish@v1.12
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
ignore_dev_requirements: "yes"


20 changes: 16 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ jobs:
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
installer-parallel: true

# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
poetry install
# Run script
- name: Run script
run: python main.py -u https://github.com/Odyssey-Team/Taurine/releases/download/1.1.6/Taurine-1.1.6.ipa -n -d
run: poetry run python3 main.py -u https://github.com/Odyssey-Team/Taurine/releases/download/1.1.6/Taurine-1.1.6.ipa -n -d

# Upload test artifact
- uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -85,6 +91,12 @@ jobs:
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
installer-parallel: true

- name: Setup Procursus Bootstrap (install)
if: steps.procache.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -113,11 +125,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
poetry install
# Run script
- name: Run script
run: python main.py -u https://github.com/Odyssey-Team/Taurine/releases/download/1.1.6/Taurine-1.1.6.ipa -n -d
run: poetry run python3 main.py -u https://github.com/Odyssey-Team/Taurine/releases/download/1.1.6/Taurine-1.1.6.ipa -n -d

# Upload test artifact
- uses: actions/upload-artifact@v3
Expand Down
5 changes: 5 additions & 0 deletions .pep8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pycodestyle]
max_line_length = 130
ignore = ["E701", "E70", "E722", "E402", "E302", "E266", "E265", "E26"]
in-place = true
recursive = true
9 changes: 2 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
FROM python:3.10.0-slim-bullseye
WORKDIR /usr/src/permasigner

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# system dependencies
RUN apt-get update
RUN apt-get upgrade -y
RUN apt install -y git gcc python3-dev

# python dependencies
COPY ./requirements.txt .
COPY . .
RUN pip install --upgrade pip setuptools wheel
RUN pip install -r requirements.txt
RUN pip install --upgrade pip setuptools wheel poetry
RUN poetry install

ENV IS_DOCKER_CONTAINER Yes
ENTRYPOINT [ "data/docker-entrypoint.sh" ]
7 changes: 1 addition & 6 deletions Dockerfile.development
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM python:3.10.0-slim-bullseye

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# system dependencies
RUN apt update
RUN apt install -y curl git gcc python3-dev

# python dependencies
COPY ./requirements.txt .
COPY . .
RUN pip install --upgrade pip setuptools wheel
RUN pip install -r requirements.txt
RUN poetry install
RUN pip install autopep8
20 changes: 11 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from utils.copy import Copy
from utils.hash import LdidHash
from utils.downloader import DpkgDeb, Ldid
import os
from pathlib import Path
from shutil import copy, copytree
Expand All @@ -16,6 +13,9 @@
from glob import glob
from subprocess import DEVNULL

from utils.copy import Copy
from utils.hash import LdidHash
from utils.downloader import DpkgDeb, Ldid

def is_ios():
# Check iOS function is up here so we can conditionally import stuff
Expand All @@ -24,14 +24,11 @@ def is_ios():

return platform.machine().startswith("i")


if not is_ios():
from utils.usbmux import USBMux
from utils.installer import Installer

""" Functions """


def cmd_in_path(args, cmd):
if args.debug:
print(f"[DEBUG] Checking if command {cmd} is in PATH...")
Expand Down Expand Up @@ -80,11 +77,14 @@ def is_dpkg_installed(pkg):


""" Main Function """


def main(args):
if subprocess.getoutput(['git', 'rev-parse', '--abbrev-ref', 'HEAD']) != "main":
ver_string = f"{subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).decode('ascii').strip()}_{subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()}"
else:
ver_string = f"{subprocess.check_output(['poetry', 'version', '--short']).decode('ascii').strip()}_rev-{subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()}"

print(
f"IPA Permasigner | Version {subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).decode('ascii').strip()}-{subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()}")
f"IPA Permasigner | Version {ver_string}")
print("Program created by Nebula | Original scripts created by zhuowei | CoreTrust bypass by Linus Henze")
print()

Expand Down Expand Up @@ -449,6 +449,8 @@ def main(args):
print("[*] Copy the newly created deb from the output folder to your jailbroken iDevice and install it!")

print("[*] The app will continue to work when rebooted to stock.")
print("[*] Also, this is free and open source software! Feel free to donate to my Patreon if you enjoy :)")
print(" https://patreon.com/nebulalol")
print(f"[*] Output file: {path_to_deb}")


Expand Down
Loading

0 comments on commit 6cad622

Please sign in to comment.