Skip to content

Commit

Permalink
Handle version in a way that works with py2app
Browse files Browse the repository at this point in the history
  • Loading branch information
brechtm committed Feb 10, 2024
1 parent ce0172e commit 53478aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 2 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from queue import Empty, Queue
from subprocess import run, Popen, DEVNULL
from threading import Thread
from pkg_resources import get_distribution

import rumps

Expand All @@ -18,7 +17,7 @@
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

from thriftybackup import CONFIG_DIR, CONFIG_PATH
from thriftybackup import __version__, CONFIG_DIR, CONFIG_PATH
from thriftybackup.config import Configuration, CONFIG_TEMPLATE
from thriftybackup.util import format_size

Expand All @@ -38,7 +37,6 @@

# change ~/Library to include-only

VERSION = get_distribution('thriftybackup').version
CHECK_INTERVAL = 5 * 60 # 5 minutes


Expand Down Expand Up @@ -159,7 +157,7 @@ def idle(self):
self.add_menuitem('Edit configuration', self.edit_config_file, ',')
self.add_menuitem('Install command-line tool', self.install_thrifty, 'c')
self.add_menuitem('Quit', self.quit, 'q')
self.add_menuitem(f'Version {VERSION}')
self.add_menuitem(f'Version {__version__}')
self._idling = True

@interface
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from setuptools import setup

from thriftybackup import __version__

OPTIONS = {
'argv_inject': [
'--echo',
Expand All @@ -15,7 +17,7 @@

setup(
name='ThriftyBackup',
version='0.0.2',
version=__version__,
app=['app.py'],
data_files=['rclone.icns'],
options={'py2app': OPTIONS},
Expand Down
3 changes: 3 additions & 0 deletions thriftybackup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from pathlib import Path


__version__ = '0.0.2'


CONFIG_DIR = Path.home() / '.config' / 'thriftybackup'
CONFIG_PATH = CONFIG_DIR / 'config.toml'

Expand Down

0 comments on commit 53478aa

Please sign in to comment.