| Message ID | 20251212091927.3741063-3-m.schwan@phytec.de |
|---|---|
| State | New |
| Headers | show |
| Series | [v2,1/5] cargo-update-recipe-crates: Make do_update_crates() a Python function | expand |
> -----Original Message----- > From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Martin Schwan via lists.openembedded.org > Sent: den 12 december 2025 10:19 > To: openembedded-core@lists.openembedded.org > Subject: [OE-core] [PATCH v2 3/5] cargo-update-recipe-crates: Consistently use single quotes in Python > > For the Python function do_update_crates(), consistently use single > quotes for Python strings. No functional changes. > > Signed-off-by: Martin Schwan <m.schwan@phytec.de> > --- > Changes in v2: > - Split changes into multiple patches, for improved readability > --- > meta/classes-recipe/cargo-update-recipe-crates.bbclass | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass > index d3745392bd..6e82bd4a51 100644 > --- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass > +++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass > @@ -45,7 +45,7 @@ python do_update_crates() { > # we need to rename crates with name and version to have a unique key > cksum_list = '' > for c in crates_candidates: > - rename = "%s-%s" % (c['name'], c['version']) > + rename = '%s-%s' % (c['name'], c['version']) > c_list += '\n crate://crates.io/%s/%s \\' % (c['name'], c['version']) > if 'checksum' in c: > cksum_list += '\nSRC_URI[%s.sha256sum] = "%s"' % (rename, c['checksum']) > @@ -56,7 +56,7 @@ python do_update_crates() { > return c_list > > import os > - crates = d.expand("# Autogenerated with 'bitbake -c update_crates ${PN}'\n\n") > + crates = d.expand('# Autogenerated with \'bitbake -c update_crates ${PN}\'\n\n') IMHO, avoiding unnecessary backslashes is preferable to only using apostrophes to quote strings. So I would skip this and the one below. > found = False > for root, dirs, files in os.walk(cargo_lock_src_dir): > # ignore git and patches directories > @@ -76,5 +76,5 @@ python do_update_crates() { > bb.error(f'Unable to find any Cargo.lock in {cargo_lock_src_dir}') > open(target_file, 'w').write(crates) > > - bb.note(f"Successfully update crates inside '{target_file}'") > + bb.note(f'Successfully update crates inside \'{target_file}\'') > } > -- > 2.43.0 //Peter
diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/meta/classes-recipe/cargo-update-recipe-crates.bbclass index d3745392bd..6e82bd4a51 100644 --- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass +++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass @@ -45,7 +45,7 @@ python do_update_crates() { # we need to rename crates with name and version to have a unique key cksum_list = '' for c in crates_candidates: - rename = "%s-%s" % (c['name'], c['version']) + rename = '%s-%s' % (c['name'], c['version']) c_list += '\n crate://crates.io/%s/%s \\' % (c['name'], c['version']) if 'checksum' in c: cksum_list += '\nSRC_URI[%s.sha256sum] = "%s"' % (rename, c['checksum']) @@ -56,7 +56,7 @@ python do_update_crates() { return c_list import os - crates = d.expand("# Autogenerated with 'bitbake -c update_crates ${PN}'\n\n") + crates = d.expand('# Autogenerated with \'bitbake -c update_crates ${PN}\'\n\n') found = False for root, dirs, files in os.walk(cargo_lock_src_dir): # ignore git and patches directories @@ -76,5 +76,5 @@ python do_update_crates() { bb.error(f'Unable to find any Cargo.lock in {cargo_lock_src_dir}') open(target_file, 'w').write(crates) - bb.note(f"Successfully update crates inside '{target_file}'") + bb.note(f'Successfully update crates inside \'{target_file}\'') }
For the Python function do_update_crates(), consistently use single quotes for Python strings. No functional changes. Signed-off-by: Martin Schwan <m.schwan@phytec.de> --- Changes in v2: - Split changes into multiple patches, for improved readability --- meta/classes-recipe/cargo-update-recipe-crates.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)