commit setconf for openSUSE:Factory

2017-10-23 Thread root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2017-10-23 16:51:56

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Mon Oct 23 16:51:56 2017 rev:9 rq:534930 version:0.7.5

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2017-05-10 
20:53:31.537378852 +0200
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2017-10-23 
16:51:57.264440307 +0200
@@ -1,0 +2,12 @@
+Wed Oct 18 06:52:11 UTC 2017 - aavind...@gmail.com
+
+- Update to version 0.7.5
+  * Can now uncomment configuration options with the -u flag.
+  * Uncommenting and setting values also works on Linux kernel
+configuration (#CONFIG_KERNEL_XY is not set to CONFIG_KERNEL_XY=y).
+- Mark python dependency
+- Lint spec file
+- Add copying-fsf.patch to fix warning about incorrect mailing address 
+  for the FSF.
+
+---

Old:

  setconf-0.7.4.tar.xz

New:

  copying-fsf.patch
  setconf-0.7.5.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.JLLbMo/_old  2017-10-23 16:51:57.744417844 +0200
+++ /var/tmp/diff_new_pack.JLLbMo/_new  2017-10-23 16:51:57.748417657 +0200
@@ -17,13 +17,16 @@
 
 
 Name:   setconf
-Version:0.7.4
+Version:0.7.5
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+
 Group:  Development/Tools/Building
 Url:http://setconf.roboticoverlords.org/
 Source: http://setconf.roboticoverlords.org/%{name}-%{version}.tar.xz
+# UPSTREAM: https://github.com/xyproto/setconf/pull/10
+Patch0: copying-fsf.patch
+Requires:   python
 BuildArch:  noarch
 
 %description
@@ -32,6 +35,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 gzip -d %{name}.1.gz
 
 %build
@@ -42,7 +46,6 @@
 install -Dpm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
 
 %files
-%defattr(-,root,root)
 %doc COPYING
 %{_bindir}/%{name}
 %{_mandir}/man?/%{name}.?%{?ext_man}

++ copying-fsf.patch ++
>From 78d50e0a8c35d3b64356d2511bcad639156b Mon Sep 17 00:00:00 2001
From: Avindra Goolcharan 
Date: Wed, 18 Oct 2017 02:57:15 -0400
Subject: [PATCH] COPYING: refresh file

The FSF address has changed. This fixes it.
---
 COPYING | 41 -
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/COPYING b/COPYING
index d60c31a..d159169 100644
--- a/COPYING
+++ b/COPYING
@@ -1,12 +1,12 @@
-   GNU GENERAL PUBLIC LICENSE
-  Version 2, June 1991
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-   Preamble
+Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its 
users.  This
 General Public License applies to most of the Free Software
 Foundation's software and to any other program whose authors commit to
 using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
+the GNU Lesser General Public License instead.)  You can apply it to
 your programs, too.
 
   When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not 
licensed at all.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-
-   GNU GENERAL PUBLIC LICENSE
+
+GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
 License.  (Exception: if the Program itself is interactive but
 does not normally print such an announcement, your work based on
 the Program is not required to print an announcement.)
-
+
 These requirements apply to the modified work as a whole.  If
 identifiable sections of that work are not derived from the Program,
 and can be reasonably consider

commit setconf for openSUSE:Factory

2017-05-10 Thread root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2017-05-10 20:53:28

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Wed May 10 20:53:28 2017 rev:8 rq:494040 version:0.7.4

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2016-05-10 
09:27:34.0 +0200
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2017-05-10 
20:53:31.537378852 +0200
@@ -1,0 +2,8 @@
+Tue May  9 16:45:47 UTC 2017 - sor.ale...@meowr.ru
+
+- Update to version 0.7.4 (changes since 0.7.2):
+  * Add Python 3.5 when testing.
+  * Can change single-line #define values by using the -d flag.
+  * Correctly formatted help text.
+
+---

Old:

  setconf-0.7.2.tar.xz

New:

  setconf-0.7.4.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.WptNm4/_old  2017-05-10 20:53:32.385259205 +0200
+++ /var/tmp/diff_new_pack.WptNm4/_new  2017-05-10 20:53:32.393258077 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package setconf
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:   setconf
-Version:0.7.2
+Version:0.7.4
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+
@@ -38,8 +38,8 @@
 # Nothing to build.
 
 %install
-install -Dm 0755 %{name}.py %{buildroot}%{_bindir}/%{name}
-install -Dm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
+install -Dpm 0755 %{name}.py %{buildroot}%{_bindir}/%{name}
+install -Dpm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
 
 %files
 %defattr(-,root,root)

++ setconf-0.7.2.tar.xz -> setconf-0.7.4.tar.xz ++
Binary files old/setconf-0.7.2/setconf.1.gz and new/setconf-0.7.4/setconf.1.gz 
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.7.2/setconf.py new/setconf-0.7.4/setconf.py
--- old/setconf-0.7.2/setconf.py2016-03-28 15:07:26.0 +0200
+++ new/setconf-0.7.4/setconf.py2016-10-30 15:46:34.0 +0100
@@ -33,7 +33,7 @@
 from decimal import Decimal
 from base64 import b64decode
 
-VERSION = "0.7.2"
+VERSION = "0.7.4"
 
 # TODO: Use optparse or argparse if shedskin is no longer a target.
 
@@ -145,7 +145,7 @@
 return passes
 
 
-def change(lines, key, value):
+def change(lines, key, value, define=False):
 key = bs(key)
 value = bs(value)
 
@@ -154,7 +154,17 @@
 if not line.strip():
 newlines.append(line)
 continue
-firstp = firstpart(line, False)
+if define:
+if line.strip().startswith(b"#define") and line.count(b" ") >= 2:
+firstp = line.split()[1].strip()
+oldvalue = line.split()[2].strip()
+if firstp == key:
+newlines.append(line.replace(oldvalue, value))
+continue
+newlines.append(line)
+continue
+else:
+firstp = firstpart(line, False)
 if not firstp:
 newlines.append(line)
 continue
@@ -187,8 +197,23 @@
 print("Change passes: %s" % (passes))
 return passes
 
+def test_change_define():
+passes = True
+
+testcontent = b"#define X 12"
+testcontent_changed = b"#define X 42"
+output = change([testcontent], "X", "42", define=True)[0]
+passes = passes and output == testcontent_changed
+
+testcontent = b"   #define   X12"
+testcontent_changed = b"   #define   X42"
+output = change([testcontent], "X", "42", define=True)[0]
+passes = passes and output == testcontent_changed
+
+print("Change define passes: %s" % (passes))
+return passes
 
-def changefile(filename, key, value, dummyrun=False):
+def changefile(filename, key, value, dummyrun=False, define=False):
 """if dummyrun==True, don't write but return True if changes would have 
been made"""
 
 key = bs(key)
@@ -209,7 +234,7 @@
 elif not data.endswith(NL):
 final_nl = False
 # Change and write the file
-changed_contents = NL.join(change(lines, key, value))
+changed_contents = NL.join(change(lines, key, value, define=define))
 # Only add a final newline if the original contents had one at the end
 if final_nl:
 changed_contents += NL
@@ -273,7 +298,7 @@
 return passes
 
 
-def change_multili

commit setconf for openSUSE:Factory

2016-05-10 Thread h_root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2016-05-10 09:27:33

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2015-07-21 
13:27:13.0 +0200
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2016-05-10 
09:27:34.0 +0200
@@ -1,0 +2,11 @@
+Sat May  7 07:12:54 UTC 2016 - sor.ale...@meowr.ru
+
+- Update to version 0.7.2 (changes since 0.6.7):
+  * Deal mainly with bytes instead of strings.
+  * Handle ISO-8859-1 (Latin1) better, for Python 3.
+  * Fix a failing testcase for +=.
+  * Fix an issue that only happened on Python 3.2.
+  * Remove a dependency on chardet.
+  * Several minor changes.
+
+---

Old:

  setconf-0.6.7.tar.xz

New:

  setconf-0.7.2.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.QsuRo9/_old  2016-05-10 09:27:35.0 +0200
+++ /var/tmp/diff_new_pack.QsuRo9/_new  2016-05-10 09:27:35.0 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package setconf
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:   setconf
-Version:0.6.7
+Version:0.7.2
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+

++ setconf-0.6.7.tar.xz -> setconf-0.7.2.tar.xz ++
Files old/setconf-0.6.7/setconf.1.gz and new/setconf-0.7.2/setconf.1.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.6.7/setconf.py new/setconf-0.7.2/setconf.py
--- old/setconf-0.6.7/setconf.py2015-06-25 21:50:37.0 +0200
+++ new/setconf-0.7.2/setconf.py2016-03-28 15:07:26.0 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/env python
 # -*- coding: utf-8 -*-
 #
 # setconf
@@ -22,30 +22,31 @@
 # Dec 2014
 # Mar 2015
 # Jun 2015
+# Mar 2016
 #
 
 from sys import argv
 from sys import exit as sysexit
-from os import linesep
+from os import linesep as linesep_str
 from os.path import exists
 from tempfile import mkstemp
-from subprocess import check_output
 from decimal import Decimal
+from base64 import b64decode
 
-# TODO: Use optparse or argparse if shedskin is no longer a target.
+VERSION = "0.7.2"
 
-VERSION = "0.6.7"
-ASSIGNMENTS = ['==', '=>', '+=', '-=', '=', ':=', '::', ':']
+# TODO: Use optparse or argparse if shedskin is no longer a target.
 
 
-def get_encoding(filename):
-"""Use the output from the file command to guess the encoding.
-Returns (True, encoding) or (False, None)"""
-s = check_output(["/usr/bin/file", filename]).strip().decode('utf-8')
-if s.endswith("text"):
-return (True, s.split(" ")[1])
-else:
-return (False, None)
+def bs(x):
+"""Convert from string to UTF-8 encoded bytes, if needed"""
+if type(x) != type(b""):
+return x.encode("utf-8")
+return x
+
+NL = bs(linesep_str)
+ASSIGNMENTS = [b'==', b'=>', b'+=', b'-=', b'?=',
+   b'=', b':=', b'::', b':']
 
 
 def parts(line, including_assignment=True):
@@ -55,14 +56,16 @@
 if not stripline:
 return None, None
 # Skip lines that start with #, // or /*
-if (stripline[0] == "#") or (stripline[:2] in ["//", "/*"]):
-return None, None
+for commentsymbol in [b"#", b"//", b"/*"]:
+if stripline.startswith(commentsymbol):
+# Skip this line
+return None, None
 # These assignments are supported, in this order
-assignment = ""
+assignment = b""
 found = []
 for ass in ASSIGNMENTS:
 # Skip the += and -= operators when finding keys and values
-if ass in ['+=', '-=']:
+if ass in [b'+=', b'-=']:
 continue
 # Collect the rest
 if ass in line:
@@ -73,7 +76,7 @@
 elif found:  # > 1
 # If several assignments are found, use the first one
 firstpos = len(line)
-firstassignment = ""
+firstassignment = b""
 for ass in found:
 pos = line.index(ass)
 if pos < firstpos:
@@ -100,12 +103,15 @@
 
 
 def changeline(line, newvalue):
+line = bs(line)
+newvalue = bs(newvalue)
+
 first = firstpart(line)
 if first:
-if "= " in line or ": " in line or "> " in line:
-return first + " " + new

commit setconf for openSUSE:Factory

2015-07-21 Thread h_root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2015-07-21 13:27:10

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2015-03-09 
10:10:22.0 +0100
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2015-07-21 
13:27:13.0 +0200
@@ -1,0 +2,6 @@
+Wed Jul 15 04:23:12 UTC 2015 - sor.ale...@meowr.ru
+
+- Update to 0.6.7:
+  * Can use floating point numbers together with += and -=.
+
+---

Old:

  setconf-0.6.6.tar.xz

New:

  setconf-0.6.7.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.GTsehK/_old  2015-07-21 13:27:13.0 +0200
+++ /var/tmp/diff_new_pack.GTsehK/_new  2015-07-21 13:27:13.0 +0200
@@ -17,14 +17,13 @@
 
 
 Name:   setconf
-Version:0.6.6
+Version:0.6.7
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+
 Group:  Development/Tools/Building
 Url:http://setconf.roboticoverlords.org/
 Source: http://setconf.roboticoverlords.org/%{name}-%{version}.tar.xz
-Requires:   python
 BuildArch:  noarch
 
 %description
@@ -33,18 +32,19 @@
 
 %prep
 %setup -q
+gzip -d %{name}.1.gz
 
 %build
 # Nothing to build.
 
 %install
 install -Dm 0755 %{name}.py %{buildroot}%{_bindir}/%{name}
-install -Dm 0644 %{name}.1.gz %{buildroot}%{_mandir}/man1/%{name}.1.gz
+install -Dm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
 
 %files
 %defattr(-,root,root)
 %doc COPYING
 %{_bindir}/%{name}
-%{_mandir}/man?/%{name}.?%{ext_man}
+%{_mandir}/man?/%{name}.?%{?ext_man}
 
 %changelog

++ setconf-0.6.6.tar.xz -> setconf-0.6.7.tar.xz ++
Files old/setconf-0.6.6/setconf.1.gz and new/setconf-0.6.7/setconf.1.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.6.6/setconf.py new/setconf-0.6.7/setconf.py
--- old/setconf-0.6.6/setconf.py2015-03-03 21:52:29.0 +0100
+++ new/setconf-0.6.7/setconf.py2015-06-25 21:50:37.0 +0200
@@ -4,7 +4,7 @@
 # setconf
 # Utility for setting options in configuration files.
 #
-# Alexander F Rødseth 
+# Alexander F Rødseth 
 #
 # GPL2
 #
@@ -21,6 +21,7 @@
 # Oct 2014
 # Dec 2014
 # Mar 2015
+# Jun 2015
 #
 
 from sys import argv
@@ -29,10 +30,11 @@
 from os.path import exists
 from tempfile import mkstemp
 from subprocess import check_output
+from decimal import Decimal
 
 # TODO: Use optparse or argparse if shedskin is no longer a target.
 
-VERSION = "0.6.6"
+VERSION = "0.6.7"
 ASSIGNMENTS = ['==', '=>', '+=', '-=', '=', ':=', '::', ':']
 
 
@@ -555,20 +557,27 @@
 return second
 return ""
 
+def strip_trailing_zeros(s):
+return s.rstrip('0').rstrip('.') if '.' in s else s
+
 def inc(startvalue, s):
 """Increase the number in the string with the given string, or return the 
same string."""
 try:
-return str(int(startvalue)+int(s))
-except ValueError:
+result = str(Decimal(startvalue)+Decimal(s))
+except ArithmeticError:
 return s
 
+return strip_trailing_zeros(result)
+
 def dec(startvalue, s):
 """Decrease the number in the string with the given string, or return the 
same string."""
 try:
-return str(int(startvalue)-int(s))
-except ValueError:
+result = str(Decimal(startvalue)-Decimal(s))
+except ArithmeticError:
 return s
 
+return strip_trailing_zeros(result)
+
 def main(args=argv[1:], exitok=True):
 if len(args) == 1:
 if args[0] in ["-t", "--test"]:
@@ -576,7 +585,7 @@
 elif args[0] in ["-h", "--help"]:
 print("setconf " + VERSION)
 print("")
-print("Changes a key in a textfile to a given value")
+print("Changes a key in a text file to a given value")
 print("")
 print("Syntax:")
 print("\tsetconf filename key value [end string for multiline 
value]")




commit setconf for openSUSE:Factory

2015-03-09 Thread h_root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2015-03-09 10:10:21

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2014-12-19 
09:37:54.0 +0100
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2015-03-09 
10:10:22.0 +0100
@@ -1,0 +2,8 @@
+Sun Mar  8 18:03:19 UTC 2015 - sor.ale...@meowr.ru
+
+- Update to 0.6.6 (changes since 0.6.4):
+  * Can now use += or -= for increasing or decreasing integer
+values.
+  * Fix a problem with files without newline endings.
+
+---

Old:

  setconf-0.6.4.tar.xz

New:

  setconf-0.6.6.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.G2viQL/_old  2015-03-09 10:10:22.0 +0100
+++ /var/tmp/diff_new_pack.G2viQL/_new  2015-03-09 10:10:22.0 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package setconf
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:   setconf
-Version:0.6.4
+Version:0.6.6
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+
@@ -45,6 +45,6 @@
 %defattr(-,root,root)
 %doc COPYING
 %{_bindir}/%{name}
-%{_mandir}/man1/%{name}.1.gz
+%{_mandir}/man?/%{name}.?%{ext_man}
 
 %changelog

++ setconf-0.6.4.tar.xz -> setconf-0.6.6.tar.xz ++
Files old/setconf-0.6.4/setconf.1.gz and new/setconf-0.6.6/setconf.1.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.6.4/setconf.py new/setconf-0.6.6/setconf.py
--- old/setconf-0.6.4/setconf.py2014-12-03 13:25:32.0 +0100
+++ new/setconf-0.6.6/setconf.py2015-03-03 21:52:29.0 +0100
@@ -20,6 +20,7 @@
 # Aug 2014
 # Oct 2014
 # Dec 2014
+# Mar 2015
 #
 
 from sys import argv
@@ -31,8 +32,9 @@
 
 # TODO: Use optparse or argparse if shedskin is no longer a target.
 
-VERSION = "0.6.4"
-ASSIGNMENTS = ['==', '=>', '=', ':=', '::', ':']
+VERSION = "0.6.6"
+ASSIGNMENTS = ['==', '=>', '+=', '-=', '=', ':=', '::', ':']
+
 
 def get_encoding(filename):
 """Use the output from the file command to guess the encoding.
@@ -43,17 +45,24 @@
 else:
 return (False, None)
 
-def firstpart(line, including_assignment=True):
+
+def parts(line, including_assignment=True):
+"""Return the key and value parts of a line, if there is an assignment 
there.
+May include the assignment as part of the key."""
 stripline = line.strip()
 if not stripline:
-return None
+return None, None
 # Skip lines that start with #, // or /*
 if (stripline[0] == "#") or (stripline[:2] in ["//", "/*"]):
-return None
+return None, None
 # These assignments are supported, in this order
 assignment = ""
 found = []
 for ass in ASSIGNMENTS:
+# Skip the += and -= operators when finding keys and values
+if ass in ['+=', '-=']:
+continue
+# Collect the rest
 if ass in line:
 found.append(ass)
 if len(found) == 1:
@@ -71,12 +80,21 @@
 assignment = firstassignment
 # Return the "key" part of the line
 if assignment:
+fields = line.split(assignment, 1)
 if including_assignment:
-return line.split(assignment, 1)[0] + assignment
+return fields[0] + assignment, fields[1]
 else:
-return line.split(assignment, 1)[0]
+return fields[0], fields[1]
 # No assignments were found
-return None
+return None, None
+
+
+def firstpart(line, including_assignment=True):
+return parts(line, including_assignment)[0]
+
+
+def secondpart(line, including_assignment=True):
+return parts(line, including_assignment)[1]
 
 
 def changeline(line, newvalue):
@@ -137,13 +155,13 @@
 testcontent = """LIGHTS =ON
 bananas= not present
 tea := yes
-crazyclown:ok
+randombob:ok
 
 """
 testcontent_changed = """LIGHTS = off
 bananas= not present
 tea := yes
-crazyclown:ok
+randombob:ok
 
 """
 passes = True
@@ -165,10 +183,16 @@
 except IOError:
 print("Can't read %s" % (filename))
 sysexit(2)
+final_nl = True
+if linesep not in data:
+lines = [data]
+final_

commit setconf for openSUSE:Factory

2014-12-19 Thread h_root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2014-12-19 09:38:55

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2014-10-22 
16:23:22.0 +0200
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2014-12-19 
09:37:54.0 +0100
@@ -1,0 +2,6 @@
+Thu Dec 19 21:39:18 UTC 2014 - sor.ale...@meowr.ru
+
+- Update to 0.6.4:
+  * Better error messages when write permissions are denied.
+
+---

Old:

  setconf-0.6.3.tar.xz

New:

  setconf-0.6.4.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.xdoRuy/_old  2014-12-19 09:37:56.0 +0100
+++ /var/tmp/diff_new_pack.xdoRuy/_new  2014-12-19 09:37:56.0 +0100
@@ -17,7 +17,7 @@
 
 
 Name:   setconf
-Version:0.6.3
+Version:0.6.4
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+

++ setconf-0.6.3.tar.xz -> setconf-0.6.4.tar.xz ++
Files old/setconf-0.6.3/setconf.1.gz and new/setconf-0.6.4/setconf.1.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.6.3/setconf.py new/setconf-0.6.4/setconf.py
--- old/setconf-0.6.3/setconf.py2014-10-13 16:23:10.0 +0200
+++ new/setconf-0.6.4/setconf.py2014-12-03 13:25:32.0 +0100
@@ -19,6 +19,7 @@
 # Nov 2013
 # Aug 2014
 # Oct 2014
+# Dec 2014
 #
 
 from sys import argv
@@ -30,7 +31,7 @@
 
 # TODO: Use optparse or argparse if shedskin is no longer a target.
 
-VERSION = "0.6.3"
+VERSION = "0.6.4"
 ASSIGNMENTS = ['==', '=>', '=', ':=', '::', ':']
 
 def get_encoding(filename):
@@ -171,7 +172,11 @@
 changed_contents += linesep
 if dummyrun:
 return data != changed_contents
-file = open(filename, "w")
+try:
+file = open(filename, "w")
+except IOError:
+print("No write permission: %s" % (filename))
+sysexit(2)
 file.write(changed_contents)
 file.close()
 
@@ -188,7 +193,11 @@
 print("Can't read %s" % (filename))
 sysexit(2)
 # Change and write the file
-file = open(filename, "w")
+try:
+file = open(filename, "w")
+except IOError:
+print("No write permission: %s" % (filename))
+sysexit(2)
 lines.append(line)
 added_data = linesep.join(lines) + linesep
 file.write(added_data)
@@ -487,7 +496,11 @@
 
 def create_if_missing(filename):
 if not exists(filename):
-f = open(filename, "w")
+try:
+f = open(filename, "w")
+except IOError:
+print("No write permission: %s" % (filename))
+sysexit(2)
 f.close()
 
 

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org



commit setconf for openSUSE:Factory

2014-10-22 Thread h_root
Hello community,

here is the log from the commit of package setconf for openSUSE:Factory checked 
in at 2014-10-22 16:23:19

Comparing /work/SRC/openSUSE:Factory/setconf (Old)
 and  /work/SRC/openSUSE:Factory/.setconf.new (New)


Package is "setconf"

Changes:

--- /work/SRC/openSUSE:Factory/setconf/setconf.changes  2014-07-20 
10:49:58.0 +0200
+++ /work/SRC/openSUSE:Factory/.setconf.new/setconf.changes 2014-10-22 
16:23:22.0 +0200
@@ -1,0 +2,7 @@
+Mon Oct 20 12:17:15 UTC 2014 - sor.ale...@meowr.ru
+
+- Update to 0.6.3:
+  * Fixed a problem with -a that occurred when a key existed but was commented 
out
+  * Added regression test
+
+---

Old:

  setconf-0.6.2.tar.xz

New:

  setconf-0.6.3.tar.xz



Other differences:
--
++ setconf.spec ++
--- /var/tmp/diff_new_pack.xWDoho/_old  2014-10-22 16:23:23.0 +0200
+++ /var/tmp/diff_new_pack.xWDoho/_new  2014-10-22 16:23:23.0 +0200
@@ -15,15 +15,15 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+
 Name:   setconf
-Version:0.6.2
+Version:0.6.3
 Release:0
 Summary:Utility to easily change settings in configuration files
 License:GPL-2.0+
 Group:  Development/Tools/Building
 Url:http://setconf.roboticoverlords.org/
-Source: %{name}-%{version}.tar.xz
-
+Source: http://setconf.roboticoverlords.org/%{name}-%{version}.tar.xz
 Requires:   python
 BuildArch:  noarch
 
@@ -38,8 +38,8 @@
 # Nothing to build.
 
 %install
-install -Dm 0755 -p %{name}.py %{buildroot}%{_bindir}/%{name}
-install -Dm 0644 -p %{name}.1.gz %{buildroot}%{_mandir}/man1/%{name}.1.gz
+install -Dm 0755 %{name}.py %{buildroot}%{_bindir}/%{name}
+install -Dm 0644 %{name}.1.gz %{buildroot}%{_mandir}/man1/%{name}.1.gz
 
 %files
 %defattr(-,root,root)

++ setconf-0.6.2.tar.xz -> setconf-0.6.3.tar.xz ++
Files old/setconf-0.6.2/setconf.1.gz and new/setconf-0.6.3/setconf.1.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/setconf-0.6.2/setconf.py new/setconf-0.6.3/setconf.py
--- old/setconf-0.6.2/setconf.py2013-11-22 12:55:35.0 +0100
+++ new/setconf-0.6.3/setconf.py2014-10-13 16:23:10.0 +0200
@@ -1,10 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # -*- coding: utf-8 -*-
 #
 # setconf
 # Utility for setting options in configuration files.
 #
-# Alexander Rødseth 
+# Alexander F Rødseth 
 #
 # GPL2
 #
@@ -17,6 +17,8 @@
 # Mar 2013
 # Jul 2013
 # Nov 2013
+# Aug 2014
+# Oct 2014
 #
 
 from sys import argv
@@ -24,12 +26,21 @@
 from os import linesep
 from os.path import exists
 from tempfile import mkstemp
+from subprocess import check_output
 
 # TODO: Use optparse or argparse if shedskin is no longer a target.
 
-VERSION = "0.6.2"
+VERSION = "0.6.3"
 ASSIGNMENTS = ['==', '=>', '=', ':=', '::', ':']
 
+def get_encoding(filename):
+"""Use the output from the file command to guess the encoding.
+Returns (True, encoding) or (False, None)"""
+s = check_output(["/usr/bin/file", filename]).strip().decode('utf-8')
+if s.endswith("text"):
+return (True, s.split(" ")[1])
+else:
+return (False, None)
 
 def firstpart(line, including_assignment=True):
 stripline = line.strip()
@@ -413,11 +424,11 @@
 
 def test_addline():
 # --- TEST 1 ---
-testcontent = "MOO=yes" + linesep
-testcontent_changed = "MOO=no" + linesep + "X=123" + linesep + \
-  "Y=345" + linesep + "Z:=567" + linesep + \
-  "FJORD => 999" + linesep + 'vm.swappiness=1' \
-  + linesep
+testcontent = "# cache-ttl=65000" + linesep + "MOO=yes" + linesep
+testcontent_changed = "# cache-ttl=65000" + linesep + "MOO=no" + linesep + 
\
+"X=123" + linesep + "Y=345" + linesep + "Z:=567" + linesep + \
+  "FJORD => 999" + linesep + 'vm.swappiness=1' + \
+  linesep + "cache-ttl=6" + linesep
 filename = mkstemp()[1]
 # Write the testfile
 file = open(filename, "w")
@@ -431,6 +442,7 @@
 main(["--add", filename, "MOO", "no"])
 main(["-a", filename, "vm.swappiness=1"])
 main(["-a", filename, "vm.swappiness=1"])
+main(["-a", filename, "cache-ttl=6"])
 # Read the file
 file = open(filename, "r")
 newcontent = file.read()
@@ -453,6 +465,7 @@
 passes = True
 passes = passes and (newcontent == testcontent_changed)
 passes = passes and (newcontent2 == testcontent_changed2)
+
 print("Addline passes: %s" % (passes))
 return passes
 
@@ -478,6 +491,19 @@
 f.close()
 
 
+