Mercurial > p > roundup > code
annotate roundup/dist/command/bdist_rpm.py @ 7478:e8d2a4bca16a
Update index. Add "track your issues your way" tag line and...
Add description of benefits to some of the noteworthy changes.
Add GTD "thing management" from old email in the 1.6 time period.
Reverse order of fast gratification so source directory is first then
venv install. Match the first line that says you don't have to
install.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 11 Jun 2023 21:32:46 -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 |
