input-remapper/setup.py

84 lines
2.7 KiB
Python
Raw Normal View History

2020-10-26 22:45:22 +00:00
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# key-mapper - GUI for device specific keyboard mappings
2021-02-22 18:48:20 +00:00
# Copyright (C) 2021 sezanzeb <proxima@sezanzeb.de>
2020-10-26 22:45:22 +00:00
#
2020-10-31 13:02:59 +00:00
# This file is part of key-mapper.
2020-10-26 22:45:22 +00:00
#
2020-10-31 13:02:59 +00:00
# key-mapper is free software: you can redistribute it and/or modify
2020-10-26 22:45:22 +00:00
# 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.
#
2020-10-31 13:02:59 +00:00
# key-mapper is distributed in the hope that it will be useful,
2020-10-26 22:45:22 +00:00
# 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
2020-10-31 13:02:59 +00:00
# along with key-mapper. If not, see <https://www.gnu.org/licenses/>.
2020-10-26 22:45:22 +00:00
2020-11-29 09:42:20 +00:00
import glob
2021-01-31 14:09:47 +00:00
import os
import re
2020-11-29 09:42:20 +00:00
from setuptools import setup
2021-01-31 14:09:47 +00:00
from setuptools.command.install import install
class Install(install):
"""Add the current commit hash to logger.py."""
def run(self):
2021-01-31 14:23:02 +00:00
commit = os.popen('git rev-parse HEAD').read().strip()
2021-01-31 14:09:47 +00:00
if re.match(r'^([a-z]|[0-9])+$', commit):
with open('keymapper/logger.py', 'r') as f:
contents = f.read()
2021-02-07 14:00:36 +00:00
contents = re.sub(
r"COMMIT_HASH = '.*?'",
2021-02-07 14:00:36 +00:00
f"COMMIT_HASH = '{commit}'",
contents
2021-01-31 14:09:47 +00:00
)
with open('keymapper/logger.py', 'w') as f:
f.write(contents)
install.run(self)
2020-10-26 22:45:22 +00:00
2020-11-29 09:42:20 +00:00
setup(
name='key-mapper',
2021-03-18 11:01:17 +00:00
version='0.7.1',
2020-11-29 09:42:20 +00:00
description='A tool to change the mapping of your input device buttons',
author='Sezanzeb',
2021-02-22 18:48:20 +00:00
author_email='proxima@sezanzeb.de',
2020-11-29 09:42:20 +00:00
url='https://github.com/sezanzeb/key-mapper',
2020-10-26 22:45:22 +00:00
license='GPL-3.0',
2020-11-29 09:42:20 +00:00
packages=[
'keymapper',
2021-02-13 19:34:33 +00:00
'keymapper.gui',
'keymapper.injection'
2020-11-29 09:42:20 +00:00
],
2020-10-26 22:45:22 +00:00
data_files=[
2020-12-25 14:39:04 +00:00
# see development.md#files
2020-11-29 12:30:16 +00:00
('/usr/share/key-mapper/', glob.glob('data/*')),
('/usr/share/applications/', ['data/key-mapper.desktop']),
('/usr/share/polkit-1/actions/', ['data/key-mapper.policy']),
('/usr/lib/systemd/system', ['data/key-mapper.service']),
('/etc/dbus-1/system.d/', ['data/keymapper.Control.conf']),
('/etc/xdg/autostart/', ['data/key-mapper-autoload.desktop']),
2021-02-07 14:00:36 +00:00
('/etc/udev/rules.d', ['data/key-mapper.rules']),
2020-11-29 12:30:16 +00:00
('/usr/bin/', ['bin/key-mapper-gtk']),
2020-12-26 22:19:33 +00:00
('/usr/bin/', ['bin/key-mapper-gtk-pkexec']),
2020-11-29 12:30:16 +00:00
('/usr/bin/', ['bin/key-mapper-service']),
('/usr/bin/', ['bin/key-mapper-control']),
2020-11-29 09:42:20 +00:00
],
2020-11-29 13:19:32 +00:00
install_requires=[
'setuptools',
'evdev',
'pydbus'
],
2021-01-31 14:09:47 +00:00
cmdclass={
'install': Install,
},
2020-10-26 22:45:22 +00:00
)