#484 wxCatapult: extract main.mk REVISION variable using pyton code

wxCatapult (26)

As I don't currently know Python (and have no plans to study it), someone please fix this.

Actually since git has neither build ids nor the notion of revisions, and since openMSX has no "t" in "x.y.x.t" version notation, we could simply get safe with REVISION always as 0.

Someone please comment on this.


  • Anonymous - 2013-07-30

    See the following block of code in build/main.mk:

    # egp_: This REVISION fix is needed since version.extractRevisionString() doesn't do its job correctly for an int-typed variable "REVISION"
    # egp_: We really need version.extractRevisionAsInt() function; not a function returning a String.
    # Normative documentation:
    # This variable REVISION must have a type int for src/catapult.rc where it includes 
    # a derived resource-info.h, to form a valid define "CATAPULT_VERSION_INT" there, 
    # to specify the following for mingw and MSVC:
    #REVISION:=$(shell PYTHONPATH=build $(PYTHON) -c \
    #     "import version; print version.extractRevisionString()" \
    #     )
    #The following is a temporary fix until the python code above gets repaired:
  • Anonymous - 2013-07-30

    I propose to deal with this as follows:

    we could always specify REVISION:=0 and not try to compute this "t" in "x.y.z.t" of version info, since "t" is not applicable for our project, and has neither sense nor meaning.

    Last edit: Anonymous 2013-07-30
  • Manuel Bilderbeek

    I think the best solution is to use the python script win_resource.py to generate the header file.

    I can't test this, but you can... try to replace this in main.mk:

    WIN32_FILEVERSION:=$(shell echo $(PACKAGE_VERSION) $(REVISION) | sed -ne 's/\([0
    -9]\)*\.\([0-9]\)*\.\([0-9]\)*[^ ]* \([0-9]*\)/\1, \2, \3, \4/p' -)
    $(RESOURCE_HEADER): $(VERSION_MAKE) forceversionextraction
            @echo "#define CATAPULT_VERSION_INT $(WIN32_FILEVERSION)" > $@
            @echo "#define CATAPULT_VERSION_STR \"$(PACKAGE_VERSION)\0\"" >> $@

    with something like this (UNTESTED, please fix):

    $(RESOURCE_HEADER): $(VERSION_MAKE) forceversionextraction
        $(PYTHON) $(BUILD_PATH)/win_resource.py $@

    Then this code isn't duplicated between main.mk and win_resource.py anymore.

    Or is this a different issue?

  • Manuel Bilderbeek

    Note that there is also a extractRevisionNumber() method in version.py.

  • Anonymous - 2013-08-11

    Manuel: Pending. I currently paused the development, as I also have other projects.

  • Manuel Bilderbeek

    As the revision extraction was completely disabled for all platforms (not only for MinGW32), I simply implemented the solution I gave above. However, I couldn't test it. So, please test it and tell me about the results.

    This was done in commit a26a2553b3235f80d294f2843e3898feb81a282b

  • Manuel Bilderbeek

    No repsonse received. I guess no one uses MinGW at the moment to build Catapult. Closing for now as fixed.

  • Manuel Bilderbeek

    • status: open --> closed-fixed