Skip to content

Commit

Permalink
try with cx_freeze for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
R3tr0BoiDX committed Oct 15, 2023
1 parent f9f75d8 commit 62d5473
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [Install](#install)
- [Precompiled binaries](#precompiled-binaries)
- [Run from source](#run-from-source)
- [Build from source](#build-from-source)
- [Setup the `config.json`](#setup-the-configjson)
- [Command line arguments](#command-line-arguments)
- [Future ideas](#future-ideas)
Expand Down Expand Up @@ -57,6 +58,10 @@ python3 -m source.main

> :warning: These instructions are intended for Linux-based systems. If you're using Windows, you can achieve similar results with PowerShell. You cannot use the `apt` command, so you'll need to manually [install Python](https://www.python.org/downloads/windows/) and change the `source.venv/bin/activate` command with `.\.venv\Scripts\Activate.ps1`.
### Build from source

If you want to take this even further and compile your own executable, you can either run the appropriate build script ([`build.linux.sh`](build.linux.sh) or [`build.windows.ps1`](build.windows.ps1)) or you follow their instructions on your own.

## Setup the `config.json`

No matter if you run from source or you prefer the precompiled binaries, both come with the [`config.example.json`](https://github.com/R3tr0BoiDX/smwc-browser/blob/master/config.example.json). You will need to **rename** this to `config.json` and fill out all the entries. It will look something like this:
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ pylint
deptry
flake8
mypy
pyinstaller
pyinstaller
cx_Freeze
40 changes: 40 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os

# from cx_Freeze import setup, Executable


def find_all_scripts(directory):
script_list = []
for root, _, files in os.walk(directory):
for file in files:
if file.endswith(".py"):
script_list.append(os.path.relpath(os.path.join(root, file)))
return script_list


def parse_requirements(requirements_file):
with open(requirements_file, mode="r", encoding="utf-8") as file:
return [line.strip() for line in file]


all_scripts = find_all_scripts("source")
print(all_scripts)

required_modules = parse_requirements("requirements.txt")
print(required_modules)


# build_exe_options = {"packages": ["os"], "includes": ["tkinter"]}
# executables=[Executable("source/main.py", base=base)]

# setup(
# name="smwc-browser",
# version="1.0",
# description="A browser for SMW Central",
# executables=[Executable(script) for script in all_scripts],
# options={
# "build_exe": {
# "packages": required_modules,
# }
# },
# )

0 comments on commit 62d5473

Please sign in to comment.