Git Product home page Git Product logo

Comments (3)

 avatar commented on July 26, 2024

Thanks for the report.

After a little bit of testing I noticed that adding a space before the first double quote in the python function lets language-bb highlight the function correctly:

FOO = "bar"

def some_python_function(d):
    bb.warn(u "PE = %s", "epoch")

FOO = "bar"

Therefore it seems there's something wrong with the string/double-quote parsing.

from language-bb.

rossburton avatar rossburton commented on July 26, 2024

I've replaced my 0.2.1 install of language-bb with a git clone but this still breaks for me.

The original source of the bad formatting was meta/classes/buildhistory.bbclass, in the write_recipeinfo function (oe-core git master).

from language-bb.

 avatar commented on July 26, 2024

Thanks for testing, you're right. The following snippet is still parsed incorrectly:

FOO = "bar"

def write_recipehistory(rcpinfo, d):
    import codecs

    bb.debug(2, "Writing recipe history")

    pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)

    infofile = os.path.join(pkghistdir, "latest")
    with codecs.open(infofile, "w", encoding='utf8') as f:
        if rcpinfo.pe != "0":
            f.write(u"PE = %s\n" %  rcpinfo.pe)
        f.write(u"PV = %s\n" %  rcpinfo.pv)
        f.write(u"PR = %s\n" %  rcpinfo.pr)
        f.write(u"DEPENDS = %s\n" %  rcpinfo.depends)
        f.write(u"PACKAGES = %s\n" %  rcpinfo.packages)

FOO = "bar"

Looks like that problem is caused by the empty newline in the python function.
Following snippet is parsed correctly:

FOO = "bar"

def write_recipehistory(rcpinfo, d):
    import codecs
    bb.debug(2, "Writing recipe history")
    pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
    infofile = os.path.join(pkghistdir, "latest")
    with codecs.open(infofile, "w", encoding='utf8') as f:
        if rcpinfo.pe != "0":
            f.write(u"PE = %s\n" %  rcpinfo.pe)
        f.write(u"PV = %s\n" %  rcpinfo.pv)
        f.write(u"PR = %s\n" %  rcpinfo.pr)
        f.write(u"DEPENDS = %s\n" %  rcpinfo.depends)
        f.write(u"PACKAGES = %s\n" %  rcpinfo.packages)

FOO = "bar"

from language-bb.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.