Mercurial > p > roundup > code
annotate roundup/dist/command/bdist_rpm.py @ 7695:2be7a8f66ea7
fix: windows install using pip mislocates share directory
The setup code that tries to make the share install path absolute
prependeds something like:
c:\program files\python_venv
to the paths. The equivalent on linux is recognized as an absolute
path. On windows this is treated oddly. This resulted in
the share files being placed in:
c:\program files\python_venv\Lib\site-packages\program files\python_venv\share
Roundup was unable to find the files there. On windows (where the
platform starts with 'win') don't make the path absolute. This puts
share in:
c:\program files\python_venv\Lib\share
and Roundup finds them.
The translations and templates are found by the roundup-server.
The docs are also installed under the share directory. The man pages
are not installed as windows doesn't have groff to format the source
documents.
This is the second fix from issues getting Roundup running on windows
discussed on mailing list by Simon Eigeldinger.
Thread starts with:
https://sourceforge.net/p/roundup/mailman/message/41557096/
subject: Installing Roundup on Windows 2023-10-05.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 05 Nov 2023 23:01:29 -0500 |
| 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 |
