Mercurial > p > roundup > code
annotate roundup/dist/command/bdist_rpm.py @ 7800:2d4684e4702d
fix: enhancement to history command output and % template fix.
Rather than using the key field, use the label field for descriptions.
Call cls.labelprop(default_to_id=True) so it returns id rather than
the first sorted property name.
If labelprop() returns 'id' or 'title', we return nothing. 'id' means
there is no label set and no properties named 'name' or 'title'. So
have the caller do whatever it wants (prepend classname for example)
when there is no human readable name. This prevents %(name)s%(key)s
from producing: 23(23).
Also don't accept the 'title' property. Titles can be too
long. Arguably we could: '%(name)20s' to limit the title
length. However without ellipses or something truncating the title
might be confusing. So again pretend there is no human readable name.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 12 Mar 2024 11:52:17 -0400 |
| parents | 551fec9c4cfc |
| children |
| rev | line source |
|---|---|
| 4068 | 1 # |
| 2 # Copyright (C) 2009 Stefan Seefeld | |
| 3 # All rights reserved. | |
| 4 # For license terms see the file COPYING.txt. | |
| 5 # | |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
6 # converted to not use distutils 2021 |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
7 from setuptools.command.bdist_rpm import bdist_rpm as base |
| 4068 | 8 import os |
| 9 | |
| 6907 | 10 |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
11 # cribbed from 2.7 distutils |
| 6907 | 12 def write_file(filename, contents): |
|
6647
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
13 """Create a file with the specified name and write 'contents' (a |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
14 sequence of strings without line terminators) to it. |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
15 """ |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
16 f = open(filename, "w") |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
17 try: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
18 for line in contents: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
19 f.write(line + "\n") |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
20 finally: |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
21 f.close() |
|
42bf0a707763
issue2551183 - Replace references to distutils in roundup/dist/command
John Rouillard <rouilj@ieee.org>
parents:
4068
diff
changeset
|
22 |
| 6907 | 23 |
| 4068 | 24 class bdist_rpm(base): |
| 25 | |
| 26 def finalize_options(self): | |
| 27 base.finalize_options(self) | |
| 28 if self.install_script: | |
| 29 # install script is overridden. skip default | |
| 30 return | |
| 31 # install script option must be file name. | |
| 32 # create the file in rpm build directory. | |
| 33 install_script = os.path.join(self.rpm_base, "install.sh") | |
| 34 self.mkpath(self.rpm_base) | |
| 35 self.execute(write_file, (install_script, [ | |
| 36 ("%s setup.py install --root=$RPM_BUILD_ROOT " | |
| 37 "--record=ROUNDUP_FILES") % self.python, | |
| 38 # allow any additional extension for man pages | |
| 39 # (rpm may compress them to .gz or .bz2) | |
| 40 # man page here is any file | |
| 41 # with single-character extension | |
| 42 # in man directory | |
| 6907 | 43 r"sed -e 's,\(/man/.*\..\)$,\\1*,' " |
| 44 "<ROUNDUP_FILES >INSTALLED_FILES", | |
| 4068 | 45 ]), "writing '%s'" % install_script) |
| 46 self.install_script = install_script |
