pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/python-versions-check



Module Name:    pkgsrc
Committed By:   wiz
Date:           Sat Jul  1 11:17:12 UTC 2023

Modified Files:
        pkgsrc/pkgtools/python-versions-check: Makefile
        pkgsrc/pkgtools/python-versions-check/files: python-versions-check
            python-versions-check.1

Log Message:
python-versions-check: add -d (debug) flag, improve docs

Bump version.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 pkgsrc/pkgtools/python-versions-check/Makefile
cvs rdiff -u -r1.1 -r1.2 \
    pkgsrc/pkgtools/python-versions-check/files/python-versions-check \
    pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/python-versions-check/Makefile
diff -u pkgsrc/pkgtools/python-versions-check/Makefile:1.1 pkgsrc/pkgtools/python-versions-check/Makefile:1.2
--- pkgsrc/pkgtools/python-versions-check/Makefile:1.1  Sat Jul  1 09:26:59 2023
+++ pkgsrc/pkgtools/python-versions-check/Makefile      Sat Jul  1 11:17:12 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.1 2023/07/01 09:26:59 wiz Exp $
+# $NetBSD: Makefile,v 1.2 2023/07/01 11:17:12 wiz Exp $
 
-PKGNAME=               python-versions-check-1.0
+PKGNAME=               python-versions-check-1.1
 CATEGORIES=            pkgtools
 
 MAINTAINER=            wiz%NetBSD.org@localhost

Index: pkgsrc/pkgtools/python-versions-check/files/python-versions-check
diff -u pkgsrc/pkgtools/python-versions-check/files/python-versions-check:1.1 pkgsrc/pkgtools/python-versions-check/files/python-versions-check:1.2
--- pkgsrc/pkgtools/python-versions-check/files/python-versions-check:1.1       Sat Jul  1 09:26:59 2023
+++ pkgsrc/pkgtools/python-versions-check/files/python-versions-check   Sat Jul  1 11:17:12 2023
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-# $NetBSD: python-versions-check,v 1.1 2023/07/01 09:26:59 wiz Exp $
+# $NetBSD: python-versions-check,v 1.2 2023/07/01 11:17:12 wiz Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -89,6 +89,8 @@ def extract_includes(path, dict_key=None
     #     # already handled
     #     return includes[dict_key]
     any_python_include = False
+    if args.debug:
+        print(f"DEBUG: parsing {path}")
     with open(path, 'r', encoding='utf-8') as input_file:
         for line in input_file.readlines():
             if m := include_re.match(line):
@@ -137,7 +139,7 @@ def absolute_path(path):
 
 def get_pkg_path(full_path):
     '''Strip pkgsrcdir from path.'''
-    cand = full_path
+    cand = str(full_path)
     if cand.startswith(args.pkgsrcdir):
         cand = cand[len(args.pkgsrcdir)+1:]
     elif cand.startswith('../../'):
@@ -156,18 +158,25 @@ def report_problem(first, first_versions
     print(f'{first}: supports {first_versions}, missing: {difference}')
 
 
-parser = argparse.ArgumentParser(description='find all packages that' +
-                                 ' link against a given package')
+if 'PKGSRCDIR' in os.environ:
+    pkgsrcdir = os.environ['PKGSRCDIR']
+else:
+    pkgsrcdir = '/usr/pkgsrc'
+
+parser = argparse.ArgumentParser(description='compare supported Python versions for package' +
+                                 'and all packages it depends upon and that depend on it')
 parser.add_argument('package', nargs='?',
                     help='package whose dependencies we want to check (default: current directory)')
-parser.add_argument('-p', dest='pkgsrcdir', default='/usr/pkgsrc',
+parser.add_argument('-d', dest='debug', default=False,
+                    help='debug mode - print each file name when its parsed', action='store_true')
+parser.add_argument('-p', dest='pkgsrcdir', default=pkgsrcdir,
                     help='path to the pkgsrc root directory', action='store')
 parser.add_argument('-w', dest='wip', default=False,
-                    help='include wip in search', action='store_true')
+                    help='include wip in search for packages using it', action='store_true')
 args = parser.parse_args()
 
 if not args.package:
-    args.package = get_pkg_path(os.getcwd())
+    args.package = get_pkg_path(pathlib.Path().resolve())
 
 if not pathlib.Path(args.pkgsrcdir).exists() or \
    not pathlib.Path(args.pkgsrcdir + '/doc').exists() or \
Index: pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1
diff -u pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1:1.1 pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1:1.2
--- pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1:1.1     Sat Jul  1 09:26:59 2023
+++ pkgsrc/pkgtools/python-versions-check/files/python-versions-check.1 Sat Jul  1 11:17:12 2023
@@ -1,4 +1,4 @@
-.\"    $NetBSD: python-versions-check.1,v 1.1 2023/07/01 09:26:59 wiz Exp $
+.\"    $NetBSD: python-versions-check.1,v 1.2 2023/07/01 11:17:12 wiz Exp $
 .\"
 .\" Copyright (c) 2023 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,16 +28,16 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .Dd June 10, 2023
-.Dt PYTHON-VERSIONS-CHECK.PY 1
+.Dt PYTHON-VERSIONS-CHECK 1
 .Os
 .Sh NAME
-.Nm python-versions-check.py
+.Nm python-versions-check
 .Nd check Python versions for a package and its dependencies and users
 .Sh SYNOPSIS
 .Nm
-.Op Fl hw
+.Op Fl dhw
 .Op Fl p Ar pkgsrcdir
-.Op Ar category/package
+.Ar category/package
 .Sh DESCRIPTION
 .Nm
 is a script for pkgsrc developers that compares the Python versions
@@ -53,16 +53,21 @@ provided.
 .Nm
 supports the following options:
 .Bl -tag -width 12n -offset indent
+.It Fl d
+Debug mode - print each file name when its parsed.
 .It Fl h
 Show the usage.
 .It Fl p Ar pkgsrcdir
 Use
 .Ar pkgsrcdir
 as root of the pkgsrc tree.
-Defaults to
-.Pa /usr/pkgsrc .
+Defaults to the value of the environment variable
+.Ev PKGSRCDIR ,
+and falls back to
+.Pa /usr/pkgsrc
+if that is not set.
 .It Fl w
-Also bump packages in the
+When looking for packages using the package, also check the
 .Pa wip/
 subtree.
 .El



Home | Main Index | Thread Index | Old Index