Skip to content

Commit

Permalink
Fight with buildozer errors, but at least compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanbobrowski committed Sep 4, 2024
1 parent 98e32f1 commit 1130fe6
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 384 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/dist
/venv
/temp
/bin
*.epub
*.pyc
__pycache__
Expand Down
20 changes: 13 additions & 7 deletions blog2epub/blog2epub_gui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import os
import platform
import re
import sys
import webbrowser
Expand All @@ -18,6 +17,7 @@
from kivymd.uix.datatables import MDDataTable # type: ignore
from kivymd.uix.tab import MDTabsBase, MDTabs # type: ignore
from kivymd.uix.textfield import MDTextField # type: ignore
from kivy.utils import platform # type: ignore

from plyer import filechooser, notification, email # type: ignore

Expand Down Expand Up @@ -65,6 +65,7 @@ def get_previous():

now = datetime.now()
date_time = now.strftime("%Y-%m-%d[%H.%M.%S]")

logging_filename = os.path.join(
str(Path.home()), ".blog2epub", f"blog2epub_{date_time}.log"
)
Expand Down Expand Up @@ -406,6 +407,11 @@ def _is_int(value) -> Optional[int]:
return None

def _get_params(self):
if platform == "android":
cache_folder = self.user_data_dir
else:
cache_folder = os.path.join(str(Path.home()), ".blog2epub")
destination_folder = str(Path.home())
return {
"interface": self.interface,
"url": self._get_url(),
Expand All @@ -418,8 +424,8 @@ def _get_params(self):
"skip": self._is_int(self.skip_entry.text),
"force_download": False,
"file_name": None,
"cache_folder": os.path.join(str(Path.home()), ".blog2epub"),
"destination_folder": str(Path.home()),
"cache_folder": cache_folder,
"destination_folder": destination_folder,
}

def _download_ebook(self, blog2epub: Blog2Epub):
Expand Down Expand Up @@ -632,12 +638,12 @@ def __init__(self):
self.title = f"blog2epub - v. {Blog2Epub.version}"
logging.info(self.title)
logging.debug(f"Metrics.density = {Metrics.density}")
if platform.system() == "Darwin":
self.icon = asset_path("blog2epub.icns")
elif platform.system() == "Windows":
if platform == "linux":
self.icon = asset_path("blog2epub.svg")
elif platform == "win":
self.icon = asset_path("blog2epub_256px.png")
else:
self.icon = asset_path("blog2epub.svg")
self.icon = asset_path("blog2epub.icns")

def build(self):
self.theme_cls.theme_style = "Light"
Expand Down
21 changes: 11 additions & 10 deletions buildozer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ title = blog2epub
package.name = blog2epub

# (str) Package domain (needed for android/ios packaging)
package.domain = com.bohdanbobrowski.blog2epub
package.domain = com.bohdanbobrowski

# (str) Source code where the main.py live
source.dir = ./
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,svg,ttf,ico

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png
source.source.include_patterns = blog2epub/**/*

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec
source.exclude_exts = spec, setup.py, pyproject.toml

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin, venv
Expand All @@ -33,21 +33,22 @@ version = 1.3.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py
# version.filename = %(source.dir)s/blog2epub_gui.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy
# requirements = python3,kivy==2.3.0,kivymd==1.2.0,altgraph,annotated-types,atoma,attrs,beautifulsoup4,certifi,charset-normalizer,click,Cython,defusedxml,docutils,EbookLib,exceptiongroup,fake-useragent,ghp-import,idna,importlib_metadata,iniconfig,Jinja2,lxml==5.3.0,Markdown,MarkupSafe,mergedeep,mkdocs,mkdocs-get-deps,mypy,mypy-extensions,packaging,pathspec,pillow,platformdirs,pluggy,plyer,pydantic,pydantic_core,pydantic_yaml,Pygments,pyinstaller,pyinstaller-hooks-contrib,pytest,python-dateutilpost0,PyYAML,pyyaml_env_tag,requests,ruamel.yaml,ruamel.yaml.clib,ruff,six,soupsieve,tomli,types-pyinstaller,types-python-dateutil,types-PyYAML,types-requests,typing_extensions,urllib3,watchdog,zipp
requirements = python3,kivy==2.3.0,kivymd==1.2.0,lxml==5.3.0,attrs,pillow,pydantic,beautifulsoup4,ebooklib,python-dateutil,atoma,fake-useragent,pyyaml,plyer,defusedxml

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (str) Presplash of the application
#presplash.filename = %(source.dir)s/data/presplash.png
presplash.filename = ./assets/blog2epub_256px.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png
icon.filename = ./assets/blog2epub_256px.png

# (list) Supported orientations
# Valid options are: landscape, portrait, portrait-reverse or landscape-reverse
Expand Down Expand Up @@ -95,7 +96,7 @@ fullscreen = 0

# (list) Permissions
# (See https://python-for-android.readthedocs.io/en/latest/buildoptions/#build-options-1 for all the supported syntaxes and properties)
#android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18)
android.permissions = android.permission.INTERNET, (name=android.permission.WRITE_EXTERNAL_STORAGE;maxSdkVersion=18)

# (list) features (adds uses-feature -tags to manifest)
#android.features = android.hardware.usb.host
Expand Down Expand Up @@ -411,7 +412,7 @@ warn_on_root = 1
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .aab, .ipa) storage
# bin_dir = ./bin
bin_dir = ./dist

# -----------------------------------------------------------------------------
# List as sections
Expand Down
18 changes: 9 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from blog2epub.blog2epub_gui import Blog2EpubKivy


def main():
Blog2EpubKivy().run()


if __name__ == "__main__":
main()
from blog2epub.blog2epub_gui import Blog2EpubKivy


def main():
Blog2EpubKivy().run()


if __name__ == "__main__":
main()
Loading

0 comments on commit 1130fe6

Please sign in to comment.