Skip to content

Commit

Permalink
v1.4.12.30
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdelsol committed Feb 23, 2024
1 parent d08ab52 commit e37cd2f
Show file tree
Hide file tree
Showing 38 changed files with 205 additions and 192 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,31 @@

[^1]: External EPG doesn't work with **local** m3u accounts.
# Download
[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.29 x64-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="30"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="30">](https://github.com/sebdelsol/sfvip-all/releases/download/v1.4.12.29/Install.Sfvip.All.x64.exe)
<sub><sup>_by Microsoft Defender • 1.1.24010.10 • 1.405.9.0_</sup></sub>
[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.30 x64-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.30/Install.Sfvip.All.1.4.12.30.x64.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.474.0_</sup></sup>

[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.29 x86-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="30"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="30">](https://github.com/sebdelsol/sfvip-all/releases/download/v1.4.12.29/Install.Sfvip.All.x86.exe)
<sub><sup>_by Microsoft Defender • 1.1.24010.10 • 1.405.9.0_</sup></sub>
[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.30 x86-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.30/Install.Sfvip.All.1.4.12.30.x86.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.474.0_</sup></sup>

Check the [***changelog***](build/changelog.md) and ***notes***[^2].
[***Sfvip Player***](https://github.com/K4L4Uz/SFVIP-Player/tree/master) will be automatically installed if missing.
Please use [***SfvipUserProxy***](user_proxy_cmd) if you need to add or remove an user proxy for ***all users*** in ***Sfvip Player*** database.

[![download](https://img.shields.io/github/downloads/sebdelsol/sfvip-all/total?label=Downloads%20since%20v1.4.12.30&logo=github)](https://tooomm.github.io/github-release-stats/?username=sebdelsol&repository=sfvip-all)

[^2]:_**Sfvip All** will ask you for network connection its first run because it relies on local proxies to do its magic._
_On **old systems** you might need to install [**vc redist**](https://learn.microsoft.com/en-GB/cpp/windows/latest-supported-vc-redist) for [**x86**](https://aka.ms/vs/17/release/vc_redist.x86.exe) or [**x64**](https://aka.ms/vs/17/release/vc_redist.x64.exe)._

# Build
[![Python](https://img.shields.io/badge/Python-3.11.8-fbdf79?logo=python&logoColor=fbdf79)](https://www.python.org/downloads/release/python-3118/)
[![mitmproxy](https://custom-icon-badges.demolab.com/badge/Mitmproxy-10.2.2-informational.svg?logo=mitmproxy)](https://mitmproxy.org/)
[![Style](https://custom-icon-badges.demolab.com/badge/Style-Black-000000.svg?logo=file-code&logoColor=a0a0a0)](https://black.readthedocs.io/en/stable/)
![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-7755-000000.svg?logo=file-code&logoColor=a0a0a0)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-7792-000000.svg?logo=file-code&logoColor=a0a0a0)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)

[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka-2.0.2-informational.svg?logo=tools&logoColor=61dafb)](https://nuitka.net/)
[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka-2.0.3-informational.svg?logo=tools&logoColor=61dafb)](https://nuitka.net/)
<sup><sub>**or**</sub></sup>
[![PyInstaller](https://custom-icon-badges.demolab.com/badge/PyInstaller-6.4.0-informational.svg?logo=tools&logoColor=61dafb)](https://pyinstaller.org/en/stable/)
<sup><sub>&ensp; **+** &ensp;</sub></sup>

[![Nsis](https://img.shields.io/badge/Nsis-3.09-informational?logo=NSIS&logoColor=fbdf79)](https://nsis.sourceforge.io/Download)

[***NSIS***](https://nsis.sourceforge.io/Download) will be automatically installed if missing.
Expand Down Expand Up @@ -83,7 +85,13 @@ It checks for _Nsis_, _Python minor update_ and all _packages dependencies_:
```console
python -m dev.upgrade [--x86 | --x64 | --both] [--noeager] [--clean] [--force]
```
### Publish an update
### Publish a release
Get a [***Github token***](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic) and set `GITHUB_TOKEN` in `api_keys.py`
```python3
# api_keys.py
GITHUB_TOKEN=your_github_token
```
Publish a release:
```console
python -m dev.publish [--x86 | --x64 | --both] [--version VERSION] [--info]
```
Expand Down
8 changes: 0 additions & 8 deletions build/1.4.12.29/post.txt

This file was deleted.

Binary file removed build/1.4.12.29/x64/Install Sfvip All.exe
Binary file not shown.
5 changes: 0 additions & 5 deletions build/1.4.12.29/x64/Install Sfvip All.scan

This file was deleted.

Binary file removed build/1.4.12.29/x86/Install Sfvip All.exe
Binary file not shown.
5 changes: 0 additions & 5 deletions build/1.4.12.29/x86/Install Sfvip All.scan

This file was deleted.

3 changes: 3 additions & 0 deletions build/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.12.30
* Use Github releases for downloads and updates.

## 1.4.12.29
* Fix all categories name for MAC accounts.

Expand Down
8 changes: 4 additions & 4 deletions build/update_x64.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"url": "https://github.com/sebdelsol/sfvip-all/releases/download/v1.4.12.29/Install.Sfvip.All.x64.exe",
"md5": "1dbce314bf357e5104df5cb67eda0b89",
"version": "1.4.12.29"
}
"url": "https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.30/Install.Sfvip.All.1.4.12.30.x64.exe",
"md5": "b7be837f064411ac7c7fe0bbd84d5847",
"version": "1.4.12.30"
}
6 changes: 3 additions & 3 deletions build/update_x86.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"url": "https://github.com/sebdelsol/sfvip-all/raw/master/build/1.4.12.29/x86/Install%20Sfvip%20All.exe",
"md5": "c3ca33cd0a925aa17dd7fb12136b8af2",
"version": "1.4.12.29"
"url": "https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.30/Install.Sfvip.All.1.4.12.30.x86.exe",
"md5": "ae216cdd0243f703eeee34874f8302cf",
"version": "1.4.12.30"
}
4 changes: 2 additions & 2 deletions build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Build:
main: ClassVar = "sfvip_all.py"
company: ClassVar = "sebdelsol"
name: ClassVar = "Sfvip All"
version: ClassVar = "1.4.12.29"
version: ClassVar = "1.4.12.30"
dir: ClassVar = "build"
enable_console: ClassVar = False
logs_dir: ClassVar = "../logs"
Expand Down Expand Up @@ -56,7 +56,7 @@ class Readme:

class Post:
src: ClassVar = "resources/post_template.txt"
dst: ClassVar = f"{Build.dir}/{Build.version}/post.txt"
dst: ClassVar = f"{Build.dir}/temp/post.{Build.version}.txt"


class Templates:
Expand Down
2 changes: 0 additions & 2 deletions dev/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from translations.loc import LOC

from .tools.builder import Builder
from .tools.cleaner import clean_old_build
from .tools.publisher import Publisher
from .tools.templater import Templater
from .tools.utils.protocols import CfgBuild, CfgEnvironments, CfgTemplate, CfgTemplates
Expand All @@ -22,7 +21,6 @@ def do_build(
Templater(build, environments, Github).create_all(templates)
if publisher:
publisher.show_versions()
clean_old_build(build, environments, Github, readme)
else:
Templater(build, environments, Github).create(readme)

Expand Down
6 changes: 0 additions & 6 deletions dev/clean.py

This file was deleted.

6 changes: 2 additions & 4 deletions dev/publish.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from build_config import Build, Environments, Github, Readme
from build_config import Build, Environments, Github

from .tools.cleaner import clean_old_build
from .tools.publisher import Publisher

if __name__ == "__main__":
publisher = Publisher(Build, Environments, Github)
if publisher.publish_all():
clean_old_build(Build, Environments, Github, Readme)
publisher.publish_all()
publisher.show_versions()
37 changes: 0 additions & 37 deletions dev/tools/cleaner.py

This file was deleted.

6 changes: 3 additions & 3 deletions dev/tools/env/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import sys
from functools import cached_property
from pathlib import Path
from typing import Literal, Optional, Sequence
from typing import Optional, Sequence

import pkg_resources

from shared import get_bitness_str
from shared import BitnessT, get_bitness_str
from shared.version import Version

from ..monitor.command import CommandMonitor
Expand Down Expand Up @@ -42,7 +42,7 @@ def exe(self) -> Path:
return self._env_path / "scripts" / "python.exe"

@cached_property
def bitness(self) -> Literal["x64", "x86"]:
def bitness(self) -> BitnessT:
return get_bitness_str(self.is_64)

@cached_property
Expand Down
27 changes: 13 additions & 14 deletions dev/tools/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import tempfile
from enum import StrEnum
from pathlib import Path
from typing import Iterator, Literal, NamedTuple, Optional, Self, Sequence
from urllib.parse import quote
from typing import Iterator, NamedTuple, Optional, Self, Sequence

import requests

from shared.update import AppLatestUpdate, AppUpdate
from shared.update import AppLatestUpdate, AppUpdate, BitnessT

from .env.envs import EnvArgs, PythonEnv, PythonEnvs
from .release import ReleaseCreator
from .utils.color import Low, Ok, Title, Warn
from .utils.dist import Dist, repr_size
from .utils.protocols import CfgBuild, CfgEnvironments, CfgGithub
Expand All @@ -24,18 +24,14 @@ class Args(EnvArgs):
class AppLatestUpdateLocal(AppLatestUpdate):
encoding = "utf-8"

def from_exe(self, exe: Path, version: str) -> Optional[AppUpdate]:
url = f"{self._github_dir}/{quote(str(exe.as_posix()))}"
return AppUpdate.from_exe(url, exe, version)

def local_load(self, bitness: Literal["x64", "x86"]) -> Optional[AppUpdate]:
def local_load(self, bitness: BitnessT) -> Optional[AppUpdate]:
update_json = self._file(bitness)
if update_json.exists():
with update_json.open(mode="r", encoding=AppLatestUpdateLocal.encoding) as f:
return AppUpdate.from_dict(json.load(f))
return None

def local_save(self, update: AppUpdate, bitness: Literal["x64", "x86"]) -> None:
def local_save(self, update: AppUpdate, bitness: BitnessT) -> None:
update_json = self._file(bitness)
with update_json.open(mode="w", encoding=AppLatestUpdateLocal.encoding) as f:
json.dump(update._asdict(), f, indent=2)
Expand Down Expand Up @@ -85,18 +81,21 @@ class Publisher:
def __init__(self, build: CfgBuild, environments: CfgEnvironments, github: CfgGithub) -> None:
self.build = build
self.dist = Dist(build)
self.release = ReleaseCreator(build, environments, github)
self.app_latest_update = AppLatestUpdateLocal(build, github)
self.all_python_envs = PythonEnvs(environments).all
self.environments = environments

def publish(self, python_env: PythonEnv) -> None:
exe = self.dist.installer_exe(python_env)
exe_str = str(exe.as_posix())
if update := self.app_latest_update.from_exe(exe, self.build.version):
self.app_latest_update.local_save(update, python_env.bitness)
print(Title("Publish update"), Ok(exe_str), Low(update.md5))
else:
print(Warn("Publish update failed"), Ok(exe_str))
version = self.build.version
if url := self.release.create(python_env, version).url:
if update := AppUpdate.from_exe(url, exe, version):
self.app_latest_update.local_save(update, python_env.bitness)
print(Title("Publish update"), Ok(exe_str), Low(update.md5))
return
print(Warn("Publish update failed"), Ok(exe_str))

def publish_all(self) -> bool:
args = Args().parse_args()
Expand Down
93 changes: 93 additions & 0 deletions dev/tools/release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from contextlib import contextmanager
from pathlib import Path
from typing import Iterator, NamedTuple, Optional

from github import Auth, Github, GithubException, UnknownObjectException
from github.GitRelease import GitRelease

from api_keys import GITHUB_TOKEN
from shared import BitnessT

from .env.envs import PythonEnv, PythonEnvs
from .scanner.file import ScanFile
from .utils.color import Low, Ok, Title, Warn
from .utils.dist import Dist, repr_size
from .utils.protocols import CfgBuild, CfgEnvironments, CfgGithub


class InstallerRelease(NamedTuple):
bitness: BitnessT
scan: ScanFile | type[ScanFile] = ScanFile
url: str = ""


class Release:
def __init__(self, dist: Dist, github: CfgGithub) -> None:
self.dist = dist
self.github = github
self.auth = Auth.Token(GITHUB_TOKEN)

@contextmanager
def get(self, version: str) -> Iterator[Optional[GitRelease]]:
with Github(auth=self.auth) as git:
user = git.get_user()
assert user.login == self.github.owner
repo = user.get_repo(self.github.repo)
tag = f"{self.dist.build_name}.{version}"
try:
release = repo.get_release(tag)
print(Title("Update Release"), Ok(tag))
except UnknownObjectException:
try:
tag = f"{self.dist.build_name}.{version}"
release = repo.create_git_release(
tag=tag,
name=tag,
message="",
target_commitish="master",
)
print(Title("Create release"), Ok(tag))
except GithubException:
print(Warn("Can't create release"), Ok(tag))
release = None
yield release


class ReleaseCreator:
def __init__(self, build: CfgBuild, environments: CfgEnvironments, github: CfgGithub) -> None:
self.dist = Dist(build)
self.release = Release(self.dist, github)
self.all_python_envs = PythonEnvs(environments).all

def add_installer(self, python_env: PythonEnv, release: Optional[GitRelease]) -> InstallerRelease:
exe = self.dist.installer_exe(python_env)
bitness = python_env.bitness
if not exe.is_file():
print(Warn(". Missing"), Low(str(exe.name)))
return InstallerRelease(bitness)
scan_file = ScanFile(exe)
if not scan_file.clean:
print(Warn(". Not clean"), Low(str(exe.name)))
return InstallerRelease(bitness)
if not release:
return InstallerRelease(bitness)
existing_assets = {Path(url := asset.browser_download_url).name: url for asset in release.get_assets()}
if url := existing_assets.get(exe.name):
print(Warn(". Already exists"), Low(str(exe.name)))
return InstallerRelease(bitness, scan_file, url)
try:
asset = release.upload_asset(path=str(exe.resolve()), name=exe.name)
print(Title(". Add"), Ok(str(exe.name)), Low(repr_size(exe)))
return InstallerRelease(bitness, scan_file, asset.browser_download_url)
except GithubException:
print(Warn(". Can't upload"), Low(str(exe.name)))
return InstallerRelease(bitness)

def create_all(self, version: str) -> Iterator[InstallerRelease]:
with self.release.get(version) as release:
for python_env in self.all_python_envs:
yield self.add_installer(python_env, release)

def create(self, python_env: PythonEnv, version: str) -> InstallerRelease:
with self.release.get(version) as release:
return self.add_installer(python_env, release)
4 changes: 2 additions & 2 deletions dev/tools/scanner/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class ScanFile(ConfigLoader):
engine: str = ""
signature: str = ""
engine: str = "unknown"
signature: str = "unknown"
clean: bool = False

def __init__(self, file: Path) -> None:
Expand Down
Loading

0 comments on commit e37cd2f

Please sign in to comment.