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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#!/usr/bin/env python
import os
import sys
from distutils.core import setup, Command
from distutils.command.build import build
from distutils.command.sdist import sdist
from glob import glob
from gkeygen import __version__, __license__
from gkeygen import Gkeys_Map
from gkeygen.actions import Action_Map, Available_Actions
from py2man import manpages
# this affects the names of all the directories we do stuff with
sys.path.insert(0, './')
#__version__ = os.getenv('VERSION', default='9999')
# Load EPREFIX from Portage, fall back to the empty string if it fails
try:
from portage.const import EPREFIX
except ImportError:
EPREFIX=''
class x_build(build):
""" Build command with extra build_man call. """
def run(self):
build.run(self)
self.run_command('build_man')
class build_man(Command):
""" Perform substitutions in manpages. """
user_options = [
]
def initialize_options(self):
self.build_base = None
def finalize_options(self):
self.set_undefined_options('build',
('build_base', 'build_base'))
def run(self):
# create the main page
basepath = os.path.dirname(__file__)
docpath = os.path.join(basepath, 'doc')
templatepath = os.path.dirname(manpages.__file__)
man = manpages.ManPage('gkeys-gen', __version__, None,
docpath, Gkeys_Map['authors'])
man.read_template(templatepath, 'command.template')
man.make_prog(Gkeys_Map)
man.read_template(templatepath, 'sub-command.template')
man.make_subpages(Action_Map, Available_Actions)
class x_sdist(sdist):
""" sdist defaulting to .tar.bz2 format """
def finalize_options(self):
if self.formats is None:
self.formats = ['bztar']
sdist.finalize_options(self)
setup(
name='gkeys-gen',
version=__version__,
description="OpenPGP/GPG key generator",
author='',
author_email='',
maintainer='Gentoo-Keys Team',
maintainer_email='gkeys@gentoo.org',
url="https://wiki.gentoo.org/wiki/Project:Gentoo-keys",
download_url='',
packages=['gkeygen'],
scripts=['bin/gkeys-gen'],
data_files=[
(os.path.join(os.sep, EPREFIX.lstrip(os.sep), 'etc/gkeys/'), ['etc/gkeys-gen.conf']),
(os.path.join(os.sep, EPREFIX.lstrip(os.sep), 'usr/share/man/man1'), glob('doc/*')),
],
license=__license__,
long_description=open('README.md').read(),
keywords='gpg',
cmdclass = {
'build': x_build,
'build_man': build_man,
'sdist': x_sdist,
},
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers, Users',
'License :: OSI Approved :: GPLv2 License',
'Programming Language :: Python :: 2.7, 3.3, 3.4, +',
'Operating System :: OS Independent',
'Topic :: Security :: Cryptography',
],
)
|