pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: clean up Glob...
details: https://anonhg.NetBSD.org/pkgsrc/rev/d5fa93827bb3
branches: trunk
changeset: 384079:d5fa93827bb3
user: rillig <rillig%pkgsrc.org@localhost>
date: Fri Aug 26 20:11:35 2022 +0000
description:
pkgtools/url2pkg: clean up Globals.pkgsrc_license
Having a nested function accessing nonlocal variables was more
complicated to understand than the straight-forward copy-and-paste code.
diffstat:
pkgtools/url2pkg/files/url2pkg.py | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diffs (31 lines):
diff -r ff9acbd02ba9 -r d5fa93827bb3 pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Fri Aug 26 18:39:43 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Fri Aug 26 20:11:35 2022 +0000
@@ -1,5 +1,5 @@
#! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.44 2022/07/16 09:16:50 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.45 2022/08/26 20:11:35 rillig Exp $
# Copyright (c) 2019 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -123,14 +123,13 @@
def pkgsrc_license(self, license_name: str) -> str:
comment = ''
- def suffix(suf: str, comm: str):
- nonlocal license_name, comment
- if comment == '' and license_name.endswith(suf):
- comment = f'\t# {comm}'
- license_name = license_name[:-len(suf)].rstrip()
+ if comment == '' and license_name.endswith('| file LICENSE'):
+ comment = f'\t# OR file LICENSE'
+ license_name = license_name[:-len('| file LICENSE')].rstrip()
- suffix('| file LICENSE', 'OR file LICENSE')
- suffix('+ file LICENSE', '+ file LICENSE')
+ if comment == '' and license_name.endswith('+ file LICENSE'):
+ comment = f'\t# + file LICENSE'
+ license_name = license_name[:-len('+ file LICENSE')].rstrip()
known_licenses = (
('2-clause-bsd', 'BSD-2', 'bsd2', 'BSD_2_clause'),
Home |
Main Index |
Thread Index |
Old Index