From e146fbf10266e97815385d66c6acd475f77b6183 Mon Sep 17 00:00:00 2001 From: John Rouillard Date: Sun, 5 Nov 2023 23:01:29 -0500 Subject: [PATCH] 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. --- CHANGES.txt | 7 ++++++- setup.py | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d711a843..bbe9710b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -69,13 +69,18 @@ Fixed: Noschvie on github.com) - support dicttoxml2.py for Roundup running on 3.7 and newer. dicttoxml uses a type alias: collection.Iterator that is - dropped in Python 3.10. (found by Norbert SCHLEMMER, fix John + dropped in Python 3.10. (found by Norbert Schlemmer, fix John Rouillard) - fix repeated password id with user.item.html in all templates except jinja2. (John Rouillard) - fix unclosed file when saving index in indexer_dbm.py. (John Rouillard) - fix task index in devel tracker so it doesn't cause a crash if all fields are selected. (John Rouillard) +- fix windows install. When using pip share directory is installed in + a directory tree under the lib directory. Fix it so that Lib/share + is used to install the share tree. The lets Roundup find tracker + templates and translation files. (Found by Simon Eigeldinger, fix + John Rouillard) Features: diff --git a/setup.py b/setup.py index 473224f3..582031df 100755 --- a/setup.py +++ b/setup.py @@ -87,6 +87,18 @@ def get_prefix(): if prefix: return prefix else: + if sys.platform.startswith('win'): + # on windows, using pip to install and + # prefixing data file paths with c:\path\a\b\... + # results in treatment as a relative path. + # The result is files are buried under: + # platlib\path\a\b\...\share\ and not findable by + # Roundup. So return no prefix which places the files at + # platlib\share\{doc,locale,roundup} where roundup can + # find templates/translations etc. + # sigh.... + return "" + # start with the platform library plp = get_path('platlib') # nuke suffix that matches lib/* and return prefix