-
Notifications
You must be signed in to change notification settings - Fork 24
/
setup.py
62 lines (56 loc) · 2.5 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Photini - a simple photo metadata editor.
# http://github.com/jim-easterbrook/Photini
# Copyright (C) 2012-24 Jim Easterbrook jim@jim-easterbrook.me.uk
#
# 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/>.
from setuptools import setup
from setuptools import __version__ as setuptools_version
if tuple(map(int, setuptools_version.split('.')[:2])) >= (61, 0):
# use metadata from pyproject.toml directly
setup()
else:
import os
# get metadata from pyproject.toml
import toml
metadata = toml.load('pyproject.toml')
with open(metadata['project']['readme']) as ldf:
long_description = ldf.read()
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 = metadata['project']['classifiers'],
license = metadata['project']['license']['text'],
packages = ['photini'],
package_dir = {'' : 'src'},
package_data = {'photini' : package_data},
entry_points = {
'console_scripts' : [
'{} = {}'.format(k, v)
for k, v in metadata['project']['scripts'].items()],
'gui_scripts' : [
'{} = {}'.format(k, v)
for k, v in metadata['project']['gui-scripts'].items()],
},
install_requires = metadata['project']['dependencies'],
extras_require = metadata['project']['optional-dependencies'],
zip_safe = metadata['tool']['setuptools']['zip-safe'],
)