From 008c7ee46b5ebfcc7ce8fab7c3470093506ea89b Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Apr 11 2013 23:21:40 +0000 Subject: New upstream release. - README file from upstream's SCM - Note patches we have for upstream --- diff --git a/.gitignore b/.gitignore index b829cd5..0af1e17 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /q-1.1.tar.gz +/q-2.3.tar.gz diff --git a/0001-q-Trace-decorator-needs-to-check-more-lines-to-work.patch b/0001-q-Trace-decorator-needs-to-check-more-lines-to-work.patch new file mode 100644 index 0000000..887e7ef --- /dev/null +++ b/0001-q-Trace-decorator-needs-to-check-more-lines-to-work.patch @@ -0,0 +1,28 @@ +From 7fb9d7b5ac5f0d50dce9336d4a1fdf57c45ecde9 Mon Sep 17 00:00:00 2001 +From: Toshio Kuratomi +Date: Thu, 11 Apr 2013 15:58:42 -0700 +Subject: [PATCH] @q Trace decorator needs to check more lines to work + +--- + q.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/q.py b/q.py +index 86e8a14..79e134d 100644 +--- a/q.py ++++ b/q.py +@@ -256,8 +256,9 @@ class Q(object): + lines = info.code_context[:info.index + 1] + + # If we see "@q" on a single line, behave like a trace decorator. +- if lines[-1].strip().startswith('@') and args: +- return self.trace(args[0]) ++ for line in lines: ++ if line.strip().startswith('@q') and args: ++ return self.trace(args[0]) + + # Otherwise, search for the beginning of the call expression; once it + # parses, use the expressions in the call to label the debugging output. +-- +1.7.11.7 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f75a1d3 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +q += + +Quick and dirty debugging output for tired programmers. + +Install q with "easy\_install -U q" or "pip install -U q". + +All output goes to /tmp/q, which you can watch with this shell command: + + tail -f /tmp/q + +To print the value of foo, insert this into your program: + + import q; q(foo) + +Use "q/" to print the value of something in the middle of an expression +while leaving the result unaffected. In this example, you can print the +value of f(y) without needing to put f(y) in a temporary variable: + + x = q/f(y) + z + +To trace a function's arguments and return value, insert this above the def: + + import q + @q diff --git a/python-q.spec b/python-q.spec index 401f4d8..78387db 100644 --- a/python-q.spec +++ b/python-q.spec @@ -2,16 +2,23 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} Name: python-q -Version: 1.1 +Version: 2.3 Release: 1%{?dist} Summary: Quick and dirty python debugging output License: ASL 2.0 URL: https://pypi.python.org/pypi/q Source0: https://pypi.python.org/packages/source/q/q/q-%{version}.tar.gz - +# README from upstream's SCM +Source1: README.md +# Fix for using @q decorator +# Submitted upstream: https://github.com/zestyping/q/pull/11 +Patch0: 0001-q-Trace-decorator-needs-to-check-more-lines-to-work.patch +# Some other patches I have pending upstream: +# python3 support https://github.com/zestyping/q/pull/9 +# Use tmpdir: https://github.com/zestyping/q/pull/8 BuildArch: noarch -BuildRequires: python-devel +BuildRequires: python2-devel %description If you've ever been frustrated trying to debug with print because a web @@ -20,7 +27,7 @@ q will make you jump for joy. import q variable = 'Hmmm... something happened here' - q.q(variable) + q(variable) cat /tmp/q @@ -28,9 +35,9 @@ cat /tmp/q %prep %setup -q -n q-%{version} +cp %{SOURCE1} . %build -# Remove CFLAGS=... for noarch packages (unneeded) %{__python} setup.py build @@ -40,11 +47,16 @@ rm -rf %{buildroot} %files -%doc +%doc README.md %{python_sitelib}/* %changelog +* Thu Apr 11 2013 Toshio Kuratomi - 2.3-1 +- New upstream release. +- README file from upstream's SCM +- Note patches we have for upstream + * Tue Mar 19 2013 Toshio Kuratomi - 1.1-1 - Initial Fedora build diff --git a/sources b/sources index 77ae4f9..a5aa950 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -0f41a751ad10f4914140fe31a045bc12 q-1.1.tar.gz +adf5c4ac3ff8b2ef33b187907c72c3e8 q-2.3.tar.gz