This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
pylock/setup.py

71 lines
2.2 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2013-04-12 21:19:57 +02:00
import distutils.core
2013-04-16 10:34:09 +02:00
import distutils.command.build
2013-04-12 21:19:57 +02:00
import distutils.command.install
2013-04-16 10:34:09 +02:00
import glob
import os
2013-04-16 10:34:09 +02:00
class build_pylock(distutils.command.build.build):
def run(self):
distutils.command.build.build.run(self)
data_files = self.distribution.data_files
if data_files is None:
# in case not data_files are defined in setup.py
self.distribution.data_files = data_files = []
for po_file in glob.glob("po/*.po"):
lang = os.path.basename(po_file[:-3])
mo_dir = os.path.join("build", "mo", lang, "LC_MESSAGES")
mo_file = os.path.join(mo_dir, "%s.mo" % self.distribution.metadata.name)
if not os.path.exists(mo_dir):
os.makedirs(mo_dir)
cmd = ["msgfmt", po_file, "-o", mo_file]
po_mtime = os.path.getmtime(po_file)
mo_mtime = os.path.exists(mo_file) and os.path.getmtime(mo_file) or 0
if po_mtime > mo_mtime:
self.spawn(cmd)
targetpath = os.path.join("share/locale", lang, "LC_MESSAGES")
data_files.append((targetpath, (mo_file,)))
class install_pylock(distutils.command.install.install):
def run(self):
2013-04-16 10:34:09 +02:00
distutils.command.install.install.run(self)
2013-04-12 20:50:05 +02:00
distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'),
preserve_times=0, preserve_symlinks=1, verbose=1)
2013-04-12 21:19:57 +02:00
distutils.core.setup(
name = 'pylock',
version = '1',
author = 'Matthias Schiffer',
author_email = 'mschiffer@universe-factory.net',
url = 'http://git.universe-factory.net/pylock/',
description = 'A lightweight screenlocker for X implemented in Python 3 using Gtk3',
license = 'BSD',
packages = ['pylock'],
package_data = {
'pylock': ['data/unlock.ui', 'data/bg.svg'],
},
2013-04-12 21:19:57 +02:00
scripts = ['scripts/pylock'],
cmdclass = {
2013-04-16 10:34:09 +02:00
'build': build_pylock,
'install': install_pylock,
},
provides = ['pylock'],
requires = [
'gi.repository.Gtk',
'gi.repository.Gdk',
'gi.repository.GdkX11',
'gi.repository.GObject',
'gi.repository.GLib',
],
)