How to read effective version of libraries?

2012-10-03
2024-07-25
  • Frank Jepsen - 2012-10-03

    Hi,

    First; I know I ask a lot in here, but I hope it is okay. After all you can just see it as interest in your product.

    I am making a script to automatically open a CoDeSys project and compile it. I would like to write the referenced libraries to a log file to be able to track exactly what was build.

    My first test includes just printing the libraries to message window, but I see here that only the library name and "chosen version" is showed; not the effective version. Is there a way to also get the effective version showed for libraries set to "newest"?

    Sample script:

    proj = projects.primary
    objects = proj.get_children(recursive=True)
    for candidate in objects:
        if candidate.is_libman:   
            libs = candidate.get_libraries(recursive=True)
            for item in libs:
                print(item)
    

    Output looks something like this:

    Zitat:
    SysTime, * (System)
    #SysTimeCore
    #SysTimeRtc
    IoStandard, 3.5.1.0 (System)
    IBase, * (System)
    CmpErrors, * (System)
    #SysTypes
    #IecTypes

    As you see the version for some libraries are * whereas I can see that IoStandard is 3.5.1.0.

    Best regards,
    Frank

     
  • Anonymous - 2012-10-04

    Originally created by: M.Schaber

    Hi, Frank,

    Currently, the effective version of a library is not readable via script.

    I created the improvement CDS-30948 in our jira database.

    HTH,
    Markus

     
  • Frank Jepsen - 2012-10-04

    Hi Markus,

    Ok. Thanks for adding it to your Jira.

    Best regards,
    Frank

     
  • torsknod - 2016-07-21

    M.Schaber hat geschrieben:
    Currently, the effective version of a library is not readable via script.
    I created the improvement CDS-30948 in our jira database.

    Is there an update to this improvement request? (So far) I have no access to jira.
    As fallback solution, I would parse an export. As this is cumbersome, I would like avoid this.

    Regards and Thanks
    Torsten Knodt

     
  • mkeller - 2016-07-21

    Hi torsknod.

    torsknod hat geschrieben:
    Gibt es hierzu etwas neues? Auf JIRA habe ich leider /bisher) keinen Zugriff.
    "Notfalls" würde ich über das Parsen eines Exports arbeiten. Da dies umständlich ist, möchte ich es gerne vermeiden.

    Der Jira wurde mit CODESYS V3.5 SP5 umgesetzt.

    Ich habe mal schnell was zusammengeschrieben:

    proj = projects.primary
    objects = proj.get_children(recursive=True)
    for candidate in objects:
       if candidate.is_libman:
          for libref in iter(candidate):
             if libref.is_placeholder:
                print "placeholder: %s: %s => %s" % (libref.name, libref.default_resolution, libref.effective_resolution)
             elif libref.is_managed:               
                print "library: %s: %s" % (libref.name, libref.managed_library.version)
             else:               
                print "library: " + libref.name
    

    BTW: Dies ist ein englisches Forum. Das nächste mal bitte in Englisch. Danke.

    BR
    Martin

     
  • torsknod - 2016-07-22

    M.Keller hat geschrieben:

    proj = projects.primary
    objects = proj.get_children(recursive=True)
    for candidate in objects:
       if candidate.is_libman:
          for libref in iter(candidate):
             if libref.is_placeholder:
                print "placeholder: %s: %s => %s" % (libref.name, libref.default_resolution, libref.effective_resolution)
             elif libref.is_managed:               
                print "library: %s: %s" % (libref.name, libref.managed_library.version)
             else:               
                print "library: " + libref.name
    

    BTW: Dies ist ein englisches Forum. Das nächste mal bitte in Englisch. Danke.

    Thanks for the fast answer. I have edited my post to be in english. I have no clue why I have answered in german.

     

Log in to post a comment.