Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: /, catalyst/, bin/
Date: Sun, 02 Mar 2014 15:42:20
Message-Id: 1393093831.46b261e967904262245c42322a96f0d7f2322a27.dol-sen@gentoo
1 commit: 46b261e967904262245c42322a96f0d7f2322a27
2 Author: W. Trevor King <wking <AT> tremily <DOT> us>
3 AuthorDate: Wed Jun 5 17:13:43 2013 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Sat Feb 22 18:30:31 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=46b261e9
7
8 setup.py: Add disutils-based packaging
9
10 Package catalyst in the usual manner for Python projects. Now it is
11 ready for PyPI :).
12
13 I also expose the version string in catalyst.__version__ and the
14 maintainer string in catalyst.__maintainer__, since those are more
15 traditional locations.
16
17 I dropped official Python 2.6 support following:
18
19 19:31 <@jmbsvicetto> I don't see a need to make catalyst
20 incompatible with 2.6, but I think it's time we drop it as a
21 "requirement". So feel free to do any changes that improve the
22 code, even if they drop 2.6 compatibility
23
24 I kept the explicit indexes in the string formatting, since Python 2.6
25 doesn't support:
26
27 '{}'.format(value)
28
29 ---
30 .gitignore | 4 +++
31 AUTHORS | 1 +
32 MANIFEST.in | 6 ++++
33 bin/catalyst | 6 ++--
34 catalyst/__init__.py | 4 +++
35 catalyst/main.py | 3 +-
36 setup.py | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++
37 7 files changed, 99 insertions(+), 6 deletions(-)
38
39 diff --git a/.gitignore b/.gitignore
40 index 539da74..d52b297 100644
41 --- a/.gitignore
42 +++ b/.gitignore
43 @@ -1 +1,5 @@
44 *.py[co]
45 +dist
46 +build
47 +files
48 +MANIFEST
49
50 diff --git a/AUTHORS b/AUTHORS
51 index 3c43706..a379d42 100644
52 --- a/AUTHORS
53 +++ b/AUTHORS
54 @@ -36,6 +36,7 @@ Lars Weiler <pylon@g.o>
55 Gustavo Zacarias <gustavoz@g.o>
56 Raúl Porcel <armin76@g.o>
57 Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>
58 +W. Trevor King <wking@×××××××.us>
59
60
61 Maintainers:
62
63 diff --git a/MANIFEST.in b/MANIFEST.in
64 new file mode 100644
65 index 0000000..4274094
66 --- /dev/null
67 +++ b/MANIFEST.in
68 @@ -0,0 +1,6 @@
69 +include AUTHORS
70 +include ChangeLog
71 +include COPYING
72 +include Makefile
73 +recursive-include doc *.conf *.py HOWTO.txt catalyst*.txt
74 +recursive-include examples README *.example *.spec
75
76 diff --git a/bin/catalyst b/bin/catalyst
77 index ace43fc..19f5289 100755
78 --- a/bin/catalyst
79 +++ b/bin/catalyst
80 @@ -12,10 +12,6 @@ from __future__ import print_function
81
82 import sys
83
84 -__maintainer__="Catalyst <catalyst@g.o>"
85 -__version__="2.0.12.2"
86 -
87 -
88 # This block ensures that ^C interrupts are handled quietly.
89 try:
90 import signal
91 @@ -36,6 +32,8 @@ except KeyboardInterrupt:
92
93
94 from catalyst.main import main
95 +from catalyst import __maintainer__
96 +from catalyst import __version__
97
98 try:
99 main()
100
101 diff --git a/catalyst/__init__.py b/catalyst/__init__.py
102 index e69de29..43a75d6 100644
103 --- a/catalyst/__init__.py
104 +++ b/catalyst/__init__.py
105 @@ -0,0 +1,4 @@
106 +"Catalyst is the release building tool used by Gentoo Linux"
107 +
108 +__version__ = '2.0.16'
109 +__maintainer__ = 'Catalyst <catalyst@g.o>'
110
111 diff --git a/catalyst/main.py b/catalyst/main.py
112 index cb30bd7..6b90989 100644
113 --- a/catalyst/main.py
114 +++ b/catalyst/main.py
115 @@ -18,13 +18,12 @@ __selfpath__ = os.path.abspath(os.path.dirname(__file__))
116
117 sys.path.append(__selfpath__ + "/modules")
118
119 +from . import __version__
120 import catalyst.config
121 import catalyst.util
122 from catalyst.support import (required_build_targets,
123 valid_build_targets, CatalystError, hash_map, find_binary, LockInUse)
124
125 -__maintainer__="Catalyst <catalyst@g.o>"
126 -__version__="2.0.15"
127
128 conf_values={}
129
130
131 diff --git a/setup.py b/setup.py
132 new file mode 100644
133 index 0000000..fb49cd6
134 --- /dev/null
135 +++ b/setup.py
136 @@ -0,0 +1,81 @@
137 +"Catalyst is the release building tool used by Gentoo Linux"
138 +
139 +import codecs as _codecs
140 +from distutils.core import setup as _setup
141 +from email.utils import parseaddr as _parseaddr
142 +import itertools as _itertools
143 +import os as _os
144 +
145 +from catalyst import __version__, __maintainer__
146 +
147 +
148 +_this_dir = _os.path.dirname(__file__)
149 +_package_name = 'catalyst'
150 +_maintainer_name, _maintainer_email = _parseaddr(__maintainer__)
151 +
152 +
153 +def _posix_path(path):
154 + """Convert a native path to a POSIX path
155 +
156 + Distutils wants all paths to be written in the Unix convention
157 + (i.e. slash-separated) [1], so that's what we'll do here.
158 +
159 + [1]: http://docs.python.org/2/distutils/setupscript.html#writing-the-setup-script
160 + """
161 + if _os.path.sep != '/':
162 + return path.replace(_os.path.sep, '/')
163 + return path
164 +
165 +
166 +def _files(prefix, root):
167 + """Iterate through all the file paths under `root`
168 +
169 + Yielding `(target_dir, (file_source_paths, ...))` tuples.
170 + """
171 + for dirpath, dirnames, filenames in _os.walk(root):
172 + reldir = _os.path.relpath(dirpath, root)
173 + install_directory = _posix_path(
174 + _os.path.join(prefix, reldir))
175 + file_source_paths = [
176 + _posix_path(_os.path.join(dirpath, filename))
177 + for filename in filenames]
178 + yield (install_directory, file_source_paths)
179 +
180 +
181 +_setup(
182 + name=_package_name,
183 + version=__version__,
184 + maintainer=_maintainer_name,
185 + maintainer_email=_maintainer_email,
186 + url='http://www.gentoo.org/proj/en/releng/{0}/'.format(_package_name),
187 + download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format(
188 + _package_name, __version__),
189 + license='GNU General Public License (GPL)',
190 + platforms=['all'],
191 + description=__doc__,
192 + long_description=_codecs.open(
193 + _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(),
194 + classifiers=[
195 + 'Development Status :: 5 - Production/Stable',
196 + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
197 + 'Intended Audience :: System Administrators',
198 + 'Operating System :: POSIX',
199 + 'Topic :: System :: Archiving :: Packaging',
200 + 'Topic :: System :: Installation/Setup',
201 + 'Topic :: System :: Software Distribution',
202 + 'Programming Language :: Python :: 2',
203 + 'Programming Language :: Python :: 2.7',
204 + ],
205 + scripts=['bin/{0}'.format(_package_name)],
206 + packages=[
207 + _package_name,
208 + '{0}.arch'.format(_package_name),
209 + '{0}.targets'.format(_package_name),
210 + ],
211 + data_files=list(_itertools.chain(
212 + _files(prefix='/etc/catalyst', root='etc'),
213 + _files(prefix='lib/catalyst/livecd', root='livecd'),
214 + _files(prefix='lib/catalyst/targets', root='targets'),
215 + )),
216 + provides=[_package_name],
217 + )