-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from jim-easterbrook/devel
Devel
- Loading branch information
Showing
21 changed files
with
240 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# ignore setuptools' idea of what should be included | ||
exclude * | ||
recursive-exclude * * | ||
# setuptools-scm automatically includes everything that's in git | ||
# ignore stuff that's not required to build photini | ||
recursive-exclude .github * | ||
recursive-exclude .tx * | ||
recursive-exclude src/doc * | ||
recursive-exclude src/lang * | ||
recursive-exclude src/Photini.egg-info * | ||
recursive-exclude tests * | ||
recursive-exclude utils * | ||
exclude .gitignore .readthedocs.yaml transifex.yml src/run_photini.py | ||
|
||
# add the minimum needed to install Photini | ||
include CHANGELOG.txt LICENSE.txt MANIFEST.in pyproject.toml README.rst setup.py | ||
recursive-include src/photini * | ||
global-exclude *~ *.pyc | ||
# add customised build stuff | ||
recursive-include custom_build *.py | ||
|
||
# add compiled translations | ||
recursive-include src/photini/data/lang *.qm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Photini - a simple photo metadata editor. | ||
# http://github.com/jim-easterbrook/Photini | ||
# Copyright (C) 2023 Jim Easterbrook [email protected] | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or (at | ||
# your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
import subprocess | ||
|
||
from setuptools import build_meta as _orig | ||
from setuptools.build_meta import * | ||
|
||
|
||
def build_lang(): | ||
src_dir = os.path.join('src', 'lang') | ||
dst_dir = os.path.join('src', 'photini', 'data', 'lang') | ||
if os.path.exists(dst_dir) and not os.path.exists(src_dir): | ||
# probably building wheel from sdist, no need to compile | ||
return | ||
print('running build_lang') | ||
os.makedirs(dst_dir, exist_ok=True) | ||
for lang in os.listdir(src_dir): | ||
src_file = os.path.join(src_dir, lang, 'photini.ts') | ||
if not os.path.exists(src_file): | ||
continue | ||
dst_file = os.path.join(dst_dir, 'photini.' + lang + '.qm') | ||
if (os.path.exists(dst_file) and | ||
os.stat(dst_file).st_mtime >= os.stat(src_file).st_mtime): | ||
continue | ||
print('compiling {} -> {}'.format(src_file, dst_file)) | ||
subprocess.check_call([ | ||
'lrelease-qt5', '-silent', src_file, '-qm', dst_file]) | ||
|
||
|
||
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): | ||
build_lang() | ||
return _orig.build_wheel(wheel_directory, config_settings=config_settings, | ||
metadata_directory=metadata_directory) | ||
|
||
|
||
def build_sdist(sdist_directory, config_settings=None): | ||
build_lang() | ||
return _orig.build_sdist(sdist_directory, config_settings=config_settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
# Photini - a simple photo metadata editor. | ||
# http://github.com/jim-easterbrook/Photini | ||
# Copyright (C) 2023 Jim Easterbrook [email protected] | ||
# | ||
# This program is free software: you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
|
||
[build-system] | ||
requires = ["setuptools >= 59.6"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["setuptools >= 59.6", "setuptools_scm[toml]>=6.2", "toml"] | ||
#build-backend = "setuptools.build_meta" | ||
build-backend = "backend" | ||
backend-path = ["custom_build"] | ||
|
||
[project] | ||
name = "Photini" | ||
|
@@ -29,15 +49,19 @@ dependencies = [ | |
dynamic = ["version"] | ||
|
||
[project.optional-dependencies] | ||
flickr = [ | ||
"requests-oauthlib >= 1.0", "requests-toolbelt >= 0.9", "keyring >= 7.0"] | ||
google = ["requests-oauthlib >= 1.0", "keyring >= 7.0"] | ||
flickr = ["photini[keyring,requests-oauthlib,requests-toolbelt]"] | ||
google = ["photini[keyring,requests-oauthlib]"] | ||
importer = ["gphoto2 >= 1.8; platform_system != 'Windows'"] | ||
ipernity = ["requests-toolbelt >= 0.9", "keyring >= 7.0"] | ||
pixelfed = [ | ||
"requests-oauthlib >= 1.0", "requests-toolbelt >= 0.9", "keyring >= 7.0"] | ||
ipernity = ["photini[keyring,requests-toolbelt]"] | ||
pixelfed = ["photini[keyring,requests-oauthlib,requests-toolbelt]"] | ||
spelling = ["pyenchant >= 2.0"] | ||
# set versions of common packages | ||
keyring = ["keyring >= 7.0"] | ||
requests-oauthlib = ["requests-oauthlib >= 1.0"] | ||
requests-toolbelt = ["requests-toolbelt >= 0.9"] | ||
# the following are intended for use by the photini-configure script | ||
PyQt5 = ["PyQt5 >= 5.9", "PyQtWebEngine >= 5.12"] | ||
PyQt6 = ["PyQt6 >= 6.2", "PyQt6-WebEngine >= 6.2"] | ||
PySide2 = ["PySide2 >= 5.11"] | ||
PySide6 = ["PySide6 >= 6.2"] | ||
gpxpy = ["gpxpy >= 1.3.5"] | ||
|
@@ -59,9 +83,10 @@ photini = "photini.editor:main" | |
[tool.setuptools] | ||
zip-safe = false | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "photini.__version__"} | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["src"] | ||
exclude = ["doc*", "lang*"] | ||
|
||
[tool.setuptools_scm] | ||
write_to = "src/photini/_version.py" | ||
version_scheme = "post-release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,103 +16,47 @@ | |
# along with this program. If not, see | ||
# <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
from setuptools import setup | ||
from setuptools import __version__ as setuptools_version | ||
|
||
|
||
# list dependency packages | ||
install_requires = ['appdirs', 'cachetools', 'chardet', 'exiv2', 'requests'] | ||
extras_require = { | ||
'basic' : ['PySide2'], | ||
'flickr' : ['requests-oauthlib', 'requests-toolbelt', 'keyring'], | ||
'google' : ['requests-oauthlib', 'keyring'], | ||
'importer' : ['gphoto2; platform_system != "Windows"'], | ||
'ipernity' : ['requests-toolbelt', 'keyring'], | ||
'pixelfed' : ['requests-oauthlib', 'requests-toolbelt', 'keyring'], | ||
'spelling' : ['pyenchant'], | ||
# the following are intended for use by the photini-configure script | ||
'PyQt5' : ['PyQt5', 'PyQtWebEngine'], | ||
'PyQt6' : ['PyQt6', 'PyQt6-WebEngine'], | ||
'PySide2' : ['PySide2'], | ||
'PySide6' : ['PySide6'], | ||
'gpxpy' : ['gpxpy'], | ||
'Pillow' : ['Pillow'], | ||
} | ||
extras_require['extras'] = list( | ||
set(extras_require['flickr']) | set(extras_require['google']) | | ||
set(extras_require['importer']) | set(extras_require['ipernity']) | | ||
set(extras_require['spelling']) | set(['gpxpy', 'Pillow'])) | ||
extras_require['win7'] = list( | ||
set(extras_require['basic']) | set(extras_require['extras'])) | ||
extras_require['win10'] = extras_require['win7'] | ||
|
||
# add version numbers | ||
min_version = { | ||
'appdirs': '1.3', 'cachetools': '3.0', 'chardet': '3.0', 'exiv2': '0.14', | ||
'gphoto2': '1.8.0', 'gpxpy': '1.3.5', 'keyring': '7.0', 'Pillow': '2.0.0', | ||
'pyenchant': '2.0', 'PyQt5': '5.9', 'PyQtWebEngine': '5.12', 'PyQt6': '6.2', | ||
'PyQt6-WebEngine': '6.2', 'PySide2': '5.11.0', 'PySide6': '6.2.0', | ||
'requests': '2.4.0', 'requests-oauthlib': '1.0', 'requests-toolbelt': '0.9', | ||
} | ||
|
||
def add_version(package): | ||
package, sep, marker = package.partition(';') | ||
return '{} >= {}'.format(package, min_version[package]) + sep + marker | ||
|
||
for option in extras_require: | ||
extras_require[option] = [add_version(x) for x in extras_require[option]] | ||
install_requires = [add_version(x) for x in install_requires] | ||
|
||
package_data = [] | ||
for root, dirs, files in os.walk('src/photini/data/'): | ||
package_data += [ | ||
os.path.join(root.replace('src/photini/', ''), x) for x in files] | ||
url = 'https://github.com/jim-easterbrook/Photini' | ||
|
||
if tuple(map(int, setuptools_version.split('.'))) >= (61, 0): | ||
# use metadata from pyproject.toml | ||
# use metadata from pyproject.toml directly | ||
setup() | ||
else: | ||
# read current version info without importing package | ||
with open('src/photini/__init__.py') as f: | ||
exec(f.read()) | ||
import os | ||
|
||
with open('README.rst') as ldf: | ||
# get metadata from pyproject.toml | ||
import toml | ||
metadata = toml.load('pyproject.toml') | ||
|
||
with open(metadata['project']['readme']) as ldf: | ||
long_description = ldf.read() | ||
|
||
setup(name = 'Photini', | ||
version = __version__, | ||
author = 'Jim Easterbrook', | ||
author_email = '[email protected]', | ||
url = url, | ||
download_url = url + '/archive/' + __version__ + '.tar.gz', | ||
description = 'Simple photo metadata editor', | ||
package_data = [] | ||
for root, dirs, files in os.walk('src/photini/data/'): | ||
package_data += [ | ||
os.path.join(root.replace('src/photini/', ''), x) for x in files] | ||
|
||
setup(name = metadata['project']['name'], | ||
author = metadata['project']['authors'][0]['name'], | ||
author_email = metadata['project']['authors'][0]['email'], | ||
url = metadata['project']['urls']['homepage'], | ||
description = metadata['project']['description'], | ||
long_description = long_description, | ||
classifiers = [ | ||
'Development Status :: 5 - Production/Stable', | ||
'Environment :: Win32 (MS Windows)', | ||
'Environment :: X11 Applications :: Qt', | ||
'Intended Audience :: End Users/Desktop', | ||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python :: 3', | ||
'Topic :: Multimedia :: Graphics', | ||
], | ||
license = 'GPLv3+', | ||
classifiers = metadata['project']['classifiers'], | ||
license = metadata['project']['license']['text'], | ||
packages = ['photini'], | ||
package_dir = {'' : 'src'}, | ||
package_data = {'photini' : package_data}, | ||
entry_points = { | ||
'console_scripts' : [ | ||
'photini-configure = photini.scripts:configure', | ||
'photini-post-install = photini.scripts:post_install', | ||
], | ||
'{} = {}'.format(k, v) | ||
for k, v in metadata['project']['scripts'].items()], | ||
'gui_scripts' : [ | ||
'photini = photini.editor:main', | ||
], | ||
'{} = {}'.format(k, v) | ||
for k, v in metadata['project']['gui-scripts'].items()], | ||
}, | ||
install_requires = install_requires, | ||
extras_require = extras_require, | ||
zip_safe = False, | ||
install_requires = metadata['project']['dependencies'], | ||
extras_require = metadata['project']['optional-dependencies'], | ||
zip_safe = metadata['tool']['setuptools']['zip-safe'], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
## Photini - a simple photo metadata editor. | ||
## http://github.com/jim-easterbrook/Photini | ||
## Copyright (C) 2023 Jim Easterbrook [email protected] | ||
## | ||
## This program is free software: you can redistribute it and/or | ||
## modify it under the terms of the GNU General Public License as | ||
## published by the Free Software Foundation, either version 3 of the | ||
## License, or (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
## General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License | ||
## along with this program. If not, see | ||
## <http://www.gnu.org/licenses/>. | ||
|
||
"""Full documentation is at https://photini.readthedocs.io/""" | ||
|
||
__version__ = '2023.6.0' | ||
build = '2731 (b059f91)' | ||
from photini._version import version as __version__ | ||
|
||
__version__, _sep, build = __version__.partition('+') | ||
build = build or 'release' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.