8 Commits

Author SHA1 Message Date
  Andrew Senetar 6a2c1eb293
Fix flake8 issues introduced in package.py 3 months ago
  Andrew Senetar 7b4c31d262
Update for macos Qt version 3 months ago
  Andrew Senetar 701e6d4bb2
Merge pull request #755 from glubsy/packaging 3 months ago
  glubsy 990eaaa797 Update requirements.txt 3 months ago
  glubsy 3255bdf0a2 Fix incorrect path 3 months ago
  glubsy 1058247b44 Fix missing application icon 3 months ago
  glubsy 7414f82e28 Fix missing directory for pixmap symlink in Debian 3 months ago
  glubsy 8105bb709f Fix debian src package build 3 months ago
7 changed files with 92 additions and 9 deletions
Split View
  1. +1
    -1
      hscommon/build.py
  2. BIN
      images/dupeguru.icns
  3. +53
    -0
      macos.md
  4. +33
    -4
      package.py
  5. +2
    -1
      pkg/debian/Makefile
  6. +1
    -1
      requirements-extra.txt
  7. +2
    -2
      requirements.txt

+ 1
- 1
hscommon/build.py View File

@@ -295,7 +295,7 @@ def build_debian_changelog(
return [s.strip() for s in result if s.strip()]

ENTRY_MODEL = (
"{pkg} ({version}-1) {distribution}; urgency=low\n\n{changes}\n "
"{pkg} ({version}) {distribution}; urgency=low\n\n{changes}\n "
"-- Virgil Dupras <[email protected]> {date}\n\n"
)
CHANGE_MODEL = " * {description}\n"


BIN
images/dupeguru.icns View File


+ 53
- 0
macos.md View File

@@ -0,0 +1,53 @@
## How to build dupeGuru for macos

### Prerequisites

- [Python 3.6+][python]
- [Xcode 12.3][xcode] or just Xcode command line tools (older versions can be used if not interested in arm macs)
- [Homebrew][homebrew]
- [qt5](https://www.qt.io/)

#### Prerequisite setup
1. Install Xcode if desired
2. Install [Homebrew][homebrew], if not on the path after install (arm based Macs) create `~/.zshrc`
with `export PATH="/opt/homebrew/bin:$PATH"`. Will need to reload terminal or source the file to take
affect.
3. Install qt5 with `brew`. If you are using a version of macos without system python 3.6+ then you will
also need to install that via brew or with pyenv.

$ brew install qt5

NOTE: Using `brew` to install qt5 is to allow pyqt5 to build without a native wheel
available. If you are using an intel based mac you can probably skip this step.

4. May need to launch a new terminal to have everything working.

### With build.py
OSX comes with a version of python 3 by default in newer versions of OSX. To produce universal
builds either the 3.8 version shipped in macos or 3.9.1 or newer needs to be used. If needing to
build pyqt5 from source then the first line below is needed, else it may be omitted. (Path shown is
for an arm mac.)

$ export PATH="/opt/homebrew/opt/qt/bin:$PATH"
$ cd <dupeGuru directory>
$ python3 -m venv ./env
$ source ./env/bin/activate
$ pip install -r requirements.txt
$ python build.py
$ python run.py

### Generate OSX Packages
The extra requirements need to be installed to run packaging: `pip install -r requirements-extra.txt`.
Run the following in the respective virtual environment.

$ python package.py

This will produce a dupeGuru.app in the dist folder.

### Running tests
The complete test suite can be run with tox just like on linux. NOTE: The extra requirements need to
be installed to run unit tests: `pip install -r requirements-extra.txt`.

[python]: http://www.python.org/
[homebrew]: https://brew.sh/
[xcode]: https://developer.apple.com/xcode/

+ 33
- 4
package.py View File

@@ -46,11 +46,11 @@ def copy_files_to_package(destpath, packages, with_so):
# include locale files if they are built otherwise exit as it will break
# the localization
if not op.exists("build/locale"):
print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...")
print('Locale files are missing. Have you run "build.py --loc"? Exiting...')
return
# include help files if they are built otherwise exit as they should be included?
if not op.exists("build/help"):
print("Help files are missing. Have you run \"build.py --doc\"? Exiting...")
print('Help files are missing. Have you run "build.py --doc"? Exiting...')
return
shutil.copytree(op.join("build", "help"), op.join(destpath, "help"))
shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale"))
@@ -161,11 +161,11 @@ def package_windows():
# include locale files if they are built otherwise exit as it will break
# the localization
if not op.exists("build/locale"):
print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...")
print('Locale files are missing. Have you run "build.py --loc"? Exiting...')
return
# include help files if they are built otherwise exit as they should be included?
if not op.exists("build/help"):
print("Help files are missing. Have you run \"build.py --doc\"? Exiting...")
print('Help files are missing. Have you run "build.py --doc"? Exiting...')
return
# create version information file from template
try:
@@ -211,6 +211,33 @@ def package_windows():
print_and_do(cmd.format(version_array[0], version_array[1], version_array[2], bits))


def package_macos():
# include locale files if they are built otherwise exit as it will break
# the localization
if not op.exists("build/locale"):
print('Locale files are missing. Have you run "build.py --loc"? Exiting...')
return
# include help files if they are built otherwise exit as they should be included?
if not op.exists("build/help"):
print('Help files are missing. Have you run "build.py --doc"? Exiting...')
return
# run pyinstaller from here:
import PyInstaller.__main__

PyInstaller.__main__.run(
[
"--name=dupeguru",
"--windowed",
"--noconfirm",
"--icon=images/dupeguru.icns",
"--osx-bundle-identifier=com.hardcoded-software.dupeguru",
"--add-data=build/locale:locale",
"--add-data=build/help:help",
"run.py",
]
)


def main():
args = parse_args()
if args.src_pkg:
@@ -220,6 +247,8 @@ def main():
print("Packaging dupeGuru with UI qt")
if sys.platform == "win32":
package_windows()
elif sys.platform == "darwin":
package_macos()
else:
if not args.arch_pkg:
distname = distro.id()


+ 2
- 1
pkg/debian/Makefile View File

@@ -8,5 +8,6 @@ all:
chmod +x src/run.py
cp -R src/ "$(CURDIR)/debian/{pkgname}/usr/share/{execname}"
cp "$(CURDIR)/debian/{execname}.desktop" "$(CURDIR)/debian/{pkgname}/usr/share/applications"
ln -s "/usr/share/{execname}/dgse_logo_128.png" "$(CURDIR)/debian/{pkgname}/usr/pixmaps/{execname}.png"
mkdir -p "$(CURDIR)/debian/{pkgname}/usr/share/pixmaps"
ln -s "/usr/share/{execname}/dgse_logo_128.png" "$(CURDIR)/debian/{pkgname}/usr/share/pixmaps/{execname}.png"
ln -s "/usr/share/{execname}/run.py" "$(CURDIR)/debian/{pkgname}/usr/bin/{execname}"

+ 1
- 1
requirements-extra.txt View File

@@ -2,4 +2,4 @@ pytest>=5,<6
flake8
tox-travis
black
pyinstaller>=4.0,<5.0; sys_platform == 'win32'
pyinstaller>=4.0,<5.0; sys_platform != 'linux'

+ 2
- 2
requirements.txt View File

@@ -1,7 +1,7 @@
Send2Trash>=1.3.0
sphinx>=1.2.2
polib>=1.0.4
hsaudiotag3k>=1.1.3
hsaudiotag3k>=1.1.3*
distro>=1.5.0
PyQt5 >=5.4,<6.0; sys_platform == 'win32'
PyQt5 >=5.4,<6.0; sys_platform != 'linux'
pywin32>=200; sys_platform == 'win32'

Loading…
Cancel
Save