Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] Install Portage using setup.py
Date: Fri, 29 Aug 2014 17:09:28
Message-Id: 20140829100804.11ebd2bf.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] Install Portage using setup.py by "Michał Górny"
1 On Sat, 23 Aug 2014 22:30:56 +0200
2 Michał Górny <mgorny@g.o> wrote:
3
4 > ---
5 > .gitignore | 1 +
6 > MANIFEST.in | 19 ++
7 > Makefile | 215 -------------------
8 > doc/Makefile | 11 -
9 > mkrelease.sh | 141 -------------
10 > pym/portage/const.py | 4 +-
11 > setup.py | 578
12 > +++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed,
13 > 600 insertions(+), 369 deletions(-) create mode 100644 MANIFEST.in
14 > delete mode 100644 Makefile
15 > delete mode 100644 doc/Makefile
16 > delete mode 100755 mkrelease.sh
17 > create mode 100755 setup.py
18 >
19 >
20 > FIXME: not used diff --git a/setup.py b/setup.py new file mode 100755
21 > index 0000000..7ffe7f0 --- /dev/null
22 > +++ b/setup.py
23
24 ...
25
26 > +
27 > +class docbook(Command):
28 > + """ Build docs using docbook. """
29 > +
30 > + user_options = [
31 > + ('doc-formats=', None, 'Documentation formats to
32 > build (all xmlto formats for docbook are allowed, comma-separated'),
33 > + ]
34 > +
35 > + def initialize_options(self):
36 > + self.doc_formats = 'xhtml,xhtml-nochunks'
37 > +
38 > + def finalize_options(self):
39 > + self.doc_formats = self.doc_formats.replace(',', '
40 > ').split() +
41 > + def run(self):
42 > + with open('doc/fragment/date', 'w'):
43 > + pass
44 > +
45 > + for f in self.doc_formats:
46 > + print('Building docs in %s format...' % f)
47 > + subprocess.check_call(['xmlto', '-o', 'doc',
48 > + '-m', 'doc/custom.xsl', f,
49 > 'doc/portage.docbook']) +
50 > +
51 > +class epydoc(Command):
52 > + """ Build API docs using epydoc. """
53 > +
54 > + user_options = [
55 > + ]
56 > +
57 > + def initialize_options(self):
58 > + self.build_lib = None
59 > +
60 > + def finalize_options(self):
61 > + self.set_undefined_options('build_py', ('build_lib',
62 > 'build_lib')) +
63 > + def run(self):
64 > + self.run_command('build_py')
65 > +
66 > + print('Building API documentation...')
67 > +
68 > + process_env = os.environ.copy()
69 > + pythonpath = self.build_lib
70 > + try:
71 > + pythonpath += ':' + process_env['PYTHONPATH']
72 > + except KeyError:
73 > + pass
74 > + process_env['PYTHONPATH'] = pythonpath
75 > +
76 > + subprocess.check_call(['epydoc', '-o', 'epydoc',
77 > + '--name', self.distribution.get_name(),
78 > + '--url', self.distribution.get_url(),
79 > + '-qq', '--no-frames', '--show-imports',
80 > + '--exclude', 'portage.tests',
81 > + '_emerge', 'portage', 'repoman'],
82 > + env = process_env)
83 > + os.remove('epydoc/api-objects.txt')
84 > +
85 > +
86 > +class install_docbook(install_data):
87 > + """ install_data for docbook docs """
88 > +
89 > + user_options = install_data.user_options
90 > +
91 > + def initialize_options(self):
92 > + install_data.initialize_options(self)
93 > + self.htmldir = None
94 > +
95 > + def finalize_options(self):
96 > + self.set_undefined_options('install', ('htmldir',
97 > 'htmldir'))
98 > + install_data.finalize_options(self)
99 > +
100 > + def run(self):
101 > + if not os.path.exists('doc/portage.html'):
102 > + self.run_command('docbook')
103 > + self.data_files = [
104 > + (self.htmldir, glob.glob('doc/*.html')),
105 > + ]
106 > + install_data.run(self)
107 > +
108 > +
109 > +class install_epydoc(install_data):
110 > + """ install_data for epydoc docs """
111 > +
112 > + user_options = install_data.user_options
113 > +
114 > + def initialize_options(self):
115 > + install_data.initialize_options(self)
116 > + self.htmldir = None
117 > +
118 > + def finalize_options(self):
119 > + self.set_undefined_options('install', ('htmldir',
120 > 'htmldir'))
121 > + install_data.finalize_options(self)
122 > +
123 > + def run(self):
124 > + if not os.path.exists('epydoc/index.html'):
125 > + self.run_command('epydoc')
126 > + self.data_files = [
127 > + (os.path.join(self.htmldir, 'api'),
128 > glob.glob('epydoc/*')),
129 > + ]
130 > + install_data.run(self)
131 > +
132 > +
133 >
134
135 Both doc and epydoc use flags, install is broken and fails with
136 permission denied error to create the /usr/share/.../portage-9999
137 directory.
138
139 ...
140
141 > +setup(
142 > + name = 'portage',
143 > + version = '2.2.12',
144
145 You've changed it to 2.2.13_pre1 in git. But it produces incorrect
146 portage-2.2.13_pre1.egginfo version for an otherwise tagged/versioned
147 9999 install.
148
149 So set this to 9999 in git and reset to the correct value for a release
150 only it looks like.
151
152 > + url = 'https://wiki.gentoo.org/wiki/Project:Portage',
153 > + author = 'Gentoo Portage Development Team',
154 > + author_email = 'dev-portage@g.o',
155 > +
156 ...
157
158
159 Also, setup.py sdist does not produce an installable tarball. It keeps
160 failing with unicode decode errors on various files on the different
161 target pythons.
162
163 eg:
164 copying and adjusting bin/fixpackages
165 -> /var/tmp/portage/sys-apps/portage-2.2.13_pre2/work/portage-2.2.13_pre2-python2_7/scripts/sbin/
166 Traceback (most recent call last): File
167 "/usr/lib64/python3.2/tokenize.py", line 298, in find_cookie
168 line_string = line.decode('utf-8') UnicodeDecodeError: 'utf-8' codec
169 can't decode byte 0xee in position 0: invalid continuation byte
170
171 -------------------------------
172
173 I have changed the version to 9999 and rebased your new-install branch
174 on currrent master, and pushed it to my github account.
175
176 https://github.com/dol-sen/portage
177
178 I also am attaching the ebuilds I edited slightly
179
180 I have uploaded the 2.2.13_pre1 and _pre2 tarballs to my dev space.
181 _pre2 differs from _pre1 in that _pre2 is with the rebased git sources,
182 while _pre1 is Michal's original branch code.
183
184 you can rename the _pre2.ebuild to _pre1.ebuild to test at your
185 pleasure.
186
187 --
188 Brian Dolbec <dolsen>

Attachments

File name MIME type
portage-9999.ebuild application/octet-stream
portage-2.2.13_pre2.ebuild application/octet-stream

Replies