Thu, Feb 26, 2015 at 11:13:46 +0100, Remi Pointel may have written:

> Le 23-02-2015 18:31, Matthew Clarke a ??crit??:
> >Hi.
> >
> >[ Sent this to the devel/tortoisehg maintainer a week ago yesterday. ]
> >[ No response yet.  Is this too late for 5.7? ]
> >
> >Since the Mercurial update from 3.0 to 3.2.3, TortoiseHg 3.0 refuses
> >to run, saying it requires Mercurial 3.0.n or 3.1.n.  Here's a diff to
> >update TortoiseHg to version 3.3, which requires Mercurial 3.2.n or 3.3.n.
> >Lightly tested on i386.
> 
> Hi,
> 
> sorry for the delay...
> 
> I don't understand why you need the config.py part?

Yeah, I should have explained that bit.

> This is the diff, does it works fine for you?
> 
> Cheers,
> 
> Remi.

No, sorry.  TortoiseHg 3.3 determines the location of the following files
at run-time:

        - The license terms text file, when the "License" button on the
          "About TortoiseHg" dialogue is pressed.

        - The translation (tortoisehg.mo) files, used if a language
          other than English is requested (e.g., via LANG or LC_ALL).

        - The .png file containing the TortoiseHg logo to show at the
          top of the "About TortoiseHg" dialogue.

(Actually, 3.0 did this too, but I didn't notice until testing 3.3.)

The code that determines those locations is installed as
lib/python/${MODPY_VERSION}/site-packages/tortoisehg/util/paths.py,
and it tries to import the locations as variable settings from
lib/python/${MODPY_VERSION}/site-packages/tortoisehg/util/config.py.

If we don't install a config.py, the code in paths.py derives locations
relative to the grandparent of the directory holding paths.py, so
TortoiseHg ends up looking for the following, none of which exist.

        - The license terms in file
          lib/python/${MODPY_VERSION}/site-packages/COPYING.txt.

        - The translation files in sub-directories of
          lib/python/${MODPY_VERSION}/site-packages/locale.

        - The .png file containing the TortoiseHg logo in
          lib/python/${MODPY_VERSION}/site-packages/icons.

I created config.py in post-extract, so it would exist before TortoiseHg
"setup.py" was run, because that "setup.py" includes the following code:

------------------------------------------------------------------------------
    # Create a config.py.  Distributions will need to supply their own
    cfgfile = os.path.join('tortoisehg', 'util', 'config.py')
    if not os.path.exists(cfgfile) and not os.path.exists('.hg/requires'):
        f = open(cfgfile, "w")
        f.write('bin_path     = "/usr/bin"\n')
        f.write('license_path = "/usr/share/doc/tortoisehg/Copying.txt.gz"\n')
        f.write('locale_path  = "/usr/share/locale"\n')
        f.write('icon_path    = "/usr/share/pixmaps/tortoisehg/icons"\n')
        f.write('nofork       = True\n')
        f.close()
------------------------------------------------------------------------------

With that config.py created by setup.py, TortoiseHg ends up looking for
the following, which don't exist or don't contain what TortoiseHg is
looking for.

        - The license terms in file
          /usr/share/doc/tortoisehg/Copying.txt.gz.

        - The translation files in sub-directories of
          /usr/share/locale.

        - The .png file containing the TortoiseHg logo in
          /usr/share/pixmaps/tortoisehg/icons.

There's already a patch for setup.py, and I thought about extending it to
patch the block of code that creates config.py, but I haven't learned yet
how to combine ${SUBST} and "make patch".  A separate files/config.py and
post-extract: ${SUBST_DATA} in Makefile seemed cleaner.

A couple of other things I should have explained about my proposed diff:

1. RUN_DEPENDS on devel/mercurial.  I proposed this change in Makefile:

------------------------------------------------------------------------------
@@ -23,9 +23,19 @@
 
 RUN_DEPENDS =          ${BUILD_DEPENDS} \
                        editors/py-qscintilla \
-                       devel/mercurial>=3.0 \
+                       devel/mercurial>=3.2,<3.4 \
                        devel/py-iniparse
------------------------------------------------------------------------------

I got the Mercurial 3.0 -> 3.2.3 update on a test machine a few weeks ago,
but it wasn't until a couple of weeks later that I next tried to actually
run hg and thg on that test machine, and found out that TortoiseHg 3.0
refused to run with Mercurial 3.2.3.  Tightening the devel/mercurial RDEP
in the TortoiseHg package would have made the problem visible when pkg_add
updated Mercurial.

Hmm.  I wonder if I can automate pulling the Mercurial RDEP versions from
the TortoiseHg sources.  No time now, and that can wait until after 5.7
anyway.  For now, I've included at the end of this message an updated
proposed patch with a comment before the RUN_DEPENDS block in Makefile.

2. Packaging COPYING.txt.  I proposed these changes in Makefile:

------------------------------------------------------------------------------
 NO_TEST =              Yes
+
+SHAREDIR =             ${PREFIX}/share/tortoisehg
+
+post-extract:
+       @${SUBST_DATA} -c ${FILESDIR}/config.py \
+               ${WRKSRC}/tortoisehg/util/config.py
+
+post-install:
+       ${INSTALL_DATA_DIR} ${SHAREDIR}
+       ${INSTALL_DATA} ${WRKSRC}/COPYING.txt ${SHAREDIR}
 
 .include <bsd.port.mk>
------------------------------------------------------------------------------

and the following related change in PLIST:

------------------------------------------------------------------------------
@@ -253,6 +253,8 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/wconfig.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/win32ill.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/win32ill.pyc
+share/tortoisehg/
+share/tortoisehg/COPYING.txt
 share/locale/ar/LC_MESSAGES/tortoisehg.mo
 share/locale/ca/LC_MESSAGES/tortoisehg.mo
 share/locale/cs/LC_MESSAGES/tortoisehg.mo
------------------------------------------------------------------------------

The post-extract is about config.py (covered earlier), but the SHAREDIR,
post-install and PLIST bits are so that we actually package and install
the license terms text file.  Without that, the "License" button in the
"About TortoiseHg" dialogue can't show the license terms.

Thanks for reading all this, and for maintaining Mercurial and TortoiseHg.

Updated proposed patch (only change: added a comment before RUN_DEPENDS in
Makefile):

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/tortoisehg/Makefile,v
retrieving revision 1.16
diff -u -u -p -r1.16 Makefile
--- Makefile    19 May 2014 19:16:17 -0000      1.16
+++ Makefile    27 Feb 2015 06:10:47 -0000
@@ -2,7 +2,7 @@
 
 COMMENT =              series of applications for Mercurial
 
-MODPY_EGG_VERSION =    3.0
+MODPY_EGG_VERSION =    3.3
 DISTNAME =             tortoisehg-${MODPY_EGG_VERSION}
 
 CATEGORIES =           devel
@@ -21,11 +21,24 @@ BUILD_DEPENDS =             x11/py-qt4 \
                        editors/qscintilla \
                        devel/py-sip
 
+# Match the devel/mercurial RUN_DEPENDS version limits with the code in
+# ${WRKSRC}/tortoisehg/util/hgversion.py.
+
 RUN_DEPENDS =          ${BUILD_DEPENDS} \
                        editors/py-qscintilla \
-                       devel/mercurial>=3.0 \
+                       devel/mercurial>=3.2,<3.4 \
                        devel/py-iniparse
 
 NO_TEST =              Yes
+
+SHAREDIR =             ${PREFIX}/share/tortoisehg
+
+post-extract:
+       @${SUBST_DATA} -c ${FILESDIR}/config.py \
+               ${WRKSRC}/tortoisehg/util/config.py
+
+post-install:
+       ${INSTALL_DATA_DIR} ${SHAREDIR}
+       ${INSTALL_DATA} ${WRKSRC}/COPYING.txt ${SHAREDIR}
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/tortoisehg/distinfo,v
retrieving revision 1.13
diff -u -u -p -r1.13 distinfo
--- distinfo    19 May 2014 19:16:17 -0000      1.13
+++ distinfo    27 Feb 2015 06:05:28 -0000
@@ -1,2 +1,2 @@
-SHA256 (tortoisehg-3.0.tar.gz) = ylNx0NcgsPViEBNhLlReo4b+krXfSpxpa3LbvnFupKc=
-SIZE (tortoisehg-3.0.tar.gz) = 8237239
+SHA256 (tortoisehg-3.3.tar.gz) = CHrwKLtUohYqMaLdgaFKPx8eEurd5CiQpImrEfcgHNs=
+SIZE (tortoisehg-3.3.tar.gz) = 8210712
Index: files/config.py
===================================================================
RCS file: files/config.py
diff -N files/config.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/config.py     27 Feb 2015 06:05:28 -0000
@@ -0,0 +1,6 @@
+# $OpenBSD$
+bin_path     = "${TRUEPREFIX}/bin"
+license_path = "${TRUEPREFIX}/share/tortoisehg/COPYING.txt"
+locale_path  = "${TRUEPREFIX}/share/locale"
+icon_path    = "${TRUEPREFIX}/share/pixmaps/tortoisehg/icons"
+nofork       = False
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/tortoisehg/pkg/PLIST,v
retrieving revision 1.10
diff -u -u -p -r1.10 PLIST
--- pkg/PLIST   19 May 2014 19:16:17 -0000      1.10
+++ pkg/PLIST   27 Feb 2015 06:05:28 -0000
@@ -80,16 +80,14 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/htmldelegate.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/htmlui.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/htmlui.pyc
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/i18n.py
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/i18n.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/icons_rc.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/icons_rc.pyc
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/infobar.py
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/infobar.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/lexers.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/lexers.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/lfprompt.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/lfprompt.pyc
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/license.py
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/license.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/manifestmodel.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/manifestmodel.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/matching.py
@@ -102,8 +100,6 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/modeltest.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/mq.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/mq.pyc
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/mqutil.py
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/mqutil.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/p4pending.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/p4pending.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/pbranch.py
@@ -112,6 +108,8 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/postreview.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/postreview_ui.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/postreview_ui.pyc
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/prune.py
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/prune.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/purge.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/purge.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/qdelete.py
@@ -140,6 +138,8 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repomodel.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/reporegistry.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/reporegistry.pyc
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repotab.py
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repotab.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repotreeitem.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repotreeitem.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/repotreemodel.py
@@ -186,14 +186,10 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/thgrepo.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/thgstrip.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/thgstrip.pyc
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/thread.py
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/thread.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/update.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/update.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/visdiff.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/visdiff.pyc
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/wctxactions.py
-lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/wctxactions.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/wctxcleaner.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/wctxcleaner.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/hgqt/webconf.py
@@ -221,6 +217,10 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/editor.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/gpg.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/gpg.pyc
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hgcommands.py
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hgcommands.pyc
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hgdispatch.py
+lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hgdispatch.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hglib.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hglib.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/hgversion.py
@@ -253,6 +253,8 @@ lib/python${MODPY_VERSION}/site-packages
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/wconfig.pyc
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/win32ill.py
 lib/python${MODPY_VERSION}/site-packages/tortoisehg/util/win32ill.pyc
+share/tortoisehg/
+share/tortoisehg/COPYING.txt
 share/locale/ar/LC_MESSAGES/tortoisehg.mo
 share/locale/ca/LC_MESSAGES/tortoisehg.mo
 share/locale/cs/LC_MESSAGES/tortoisehg.mo
@@ -460,6 +462,7 @@ share/pixmaps/tortoisehg/icons/scalable/
 share/pixmaps/tortoisehg/icons/scalable/status/hg-patch-applied.svg
 share/pixmaps/tortoisehg/icons/scalable/status/hg-patch-guarded.svg
 share/pixmaps/tortoisehg/icons/scalable/status/hg-patch-unguarded.svg
+share/pixmaps/tortoisehg/icons/scalable/status/hg-sharedrepo.svg
 share/pixmaps/tortoisehg/icons/scalable/status/thg-added-subrepo.svg
 share/pixmaps/tortoisehg/icons/scalable/status/thg-error.svg
 share/pixmaps/tortoisehg/icons/scalable/status/thg-git-subrepo.svg

-- 
Savage's Law of Expediency:
        You want it bad, you'll get it bad.

Reply via email to