Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package opi for openSUSE:Factory checked in 
at 2021-08-23 10:08:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/opi (Old)
 and      /work/SRC/openSUSE:Factory/.opi.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "opi"

Mon Aug 23 10:08:06 2021 rev:21 rq:913371 version:2.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/opi/opi.changes  2021-08-11 11:47:50.553701365 
+0200
+++ /work/SRC/openSUSE:Factory/.opi.new.1899/opi.changes        2021-08-23 
10:09:07.408179675 +0200
@@ -1,0 +2,10 @@
+Fri Aug 20 14:31:21 UTC 2021 - Dominik Heidler <[email protected]>
+
+- Version 2.2.0
+  * Added
+    - Plugin for MEGA
+    - Plugin for Edge Beta
+    - Argument parser with option for reverse output order
+
+
+-------------------------------------------------------------------

Old:
----
  opi-2.1.1.tar.gz

New:
----
  opi-2.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ opi.spec ++++++
--- /var/tmp/diff_new_pack.8YAz9X/_old  2021-08-23 10:09:07.952179041 +0200
+++ /var/tmp/diff_new_pack.8YAz9X/_new  2021-08-23 10:09:07.952179041 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           opi
-Version:        2.1.1
+Version:        2.2.0
 Release:        0
 Summary:        OBS Package Installer (CLI)
 License:        GPL-3.0-only

++++++ opi-2.1.1.tar.gz -> opi-2.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/CHANGELOG.md new/opi-2.2.0/CHANGELOG.md
--- old/opi-2.1.1/CHANGELOG.md  2021-08-10 11:30:42.000000000 +0200
+++ new/opi-2.2.0/CHANGELOG.md  2021-08-20 16:28:49.000000000 +0200
@@ -7,6 +7,14 @@
 
 ## [Unreleased]
 
+## [2.2.0] - 2021-08-20
+
+### Added
+
+- Plugin for MEGA
+- Plugin for Edge Beta
+- Argument parser with option for reverse output order
+
 ## [2.1.1] - 2021-08-10
 
 ### Added
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/bin/opi new/opi-2.2.0/bin/opi
--- old/opi-2.1.1/bin/opi       2021-08-10 11:30:42.000000000 +0200
+++ new/opi-2.2.0/bin/opi       2021-08-20 16:28:49.000000000 +0200
@@ -2,6 +2,8 @@
 
 import os
 import sys
+import argparse
+import textwrap
 sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/..'))
 
 import opi
@@ -9,36 +11,41 @@
 from opi.version import __version__
 
 try:
-       query = ' '.join(sys.argv[1:])
-
        pm = PluginManager()
-       if query in ('', '-h', '--help'):
-               print("openSUSE Package Installer")
-               print("==========================\n")
-
-               print("Search and install almost all packages available for 
openSUSE and SLE:")
-               print(" 1. openSUSE Build Service")
-               print(" 2. Packman")
-               print(" 2. Popular packages for various vendors\n")
-
-               print("Usage: opi <query>\n")
-               print("  <query> can be any package name or part of it and will 
be searched for")
-               print("  both at the openSUSE Build Service and Packman.\n")
-
-               print("Also this queries can be used to install packages from 
various other vendors:\n")
-               pm.show_plugins(' '*2)
-               print()
-               sys.exit()
-       elif query in ('-v', '--version'):
-               print('opi version %s' % __version__)
+       ap = argparse.ArgumentParser(
+               formatter_class=argparse.RawDescriptionHelpFormatter,
+               description=textwrap.dedent('''\
+                       openSUSE Package Installer
+                       ==========================
+
+                       Search and install almost all packages available for 
openSUSE and SLE:
+                         1. openSUSE Build Service
+                         2. Packman
+                         2. Popular packages for various vendors
+
+               '''),
+               epilog=textwrap.dedent('''\
+                       Also these queries can be used to install packages from 
various other vendors:
+               ''') + pm.get_plugin_string(' '*2))
+
+       ap.add_argument('query', nargs='?', type=str,
+               help='can be any package name or part of it and will be 
searched for both at the openSUSE Build Service and Packman.'
+       )
+       ap.add_argument('-v', '--version', action='version', version=('opi 
version ' +  __version__))
+       ap.add_argument('-r', '--reversed-output', action='store_true', 
help='print the search results in reverse')
+
+       args = ap.parse_args()
+
+       if len(sys.argv) < 2:
+               ap.print_help()
                sys.exit()
 
        # Try to find a matching plugin for the query (and run it and exit 
afterwards)
-       pm.run(query)
+       pm.run(args.query)
 
        binaries = []
-       binaries.extend(opi.search_published_binary('openSUSE', query))
-       binaries.extend(opi.search_published_binary('Packman', query))
+       binaries.extend(opi.search_published_binary('openSUSE', args.query))
+       binaries.extend(opi.search_published_binary('Packman', args.query))
        binaries = opi.sort_binaries(binaries)
        if len(binaries) == 0:
                print("No package found.")
@@ -46,7 +53,7 @@
        binary_names = opi.get_binary_names(binaries)
 
        # Print package name options
-       opi.print_package_names(binary_names)
+       opi.print_package_names(binary_names, reverse=args.reversed_output)
 
        # Select a package name option
        selected_name_num = opi.ask_number(1, len(binary_names))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/__init__.py 
new/opi-2.2.0/opi/__init__.py
--- old/opi-2.1.1/opi/__init__.py       2021-08-10 11:30:42.000000000 +0200
+++ new/opi-2.2.0/opi/__init__.py       2021-08-20 16:28:49.000000000 +0200
@@ -291,13 +291,14 @@
        return answer.strip().lower() == 'y'
 
 def ask_number(min_num, max_num, question="Choose a number (0 to quit):"):
-       num = int(input(question + ' ').strip() or '0')
+       input_string = input(question + ' ').strip() or '0'
+       num = int(input_string) if input_string.isdecimal() else -1
        if num == 0:
                sys.exit()
        elif num >= min_num and num <= max_num:
                return num
        else:
-               return ask_number(question, min_num, max_num)
+               return ask_number(min_num, max_num, question)
 
 def ask_keep_repo(repo):
        if not ask_yes_or_no('Do you want to keep the repo "%s"?' % repo, 'y'):
@@ -306,11 +307,16 @@
                if get_backend() == BackendConstants.dnf:
                        subprocess.call(['sudo', 'rm', '/etc/zypp/repos.d/' + 
repo + '.repo'])
 
-def print_package_names(package_names):
+def print_package_names(package_names, reverse=False):
+       package_list = []
        i = 1
        for package_name in package_names:
-               print("%2d. %s" % (i, package_name))
+               package_list.append("%2d. %s" % (i, package_name))
                i += 1
+       if reverse:
+               package_list.reverse()
+       for e in package_list:
+               print(e)
 
 def print_binary_options(binaries):
        i = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/__init__.py 
new/opi-2.2.0/opi/plugins/__init__.py
--- old/opi-2.1.1/opi/plugins/__init__.py       2021-08-10 11:30:42.000000000 
+0200
+++ new/opi-2.2.0/opi/plugins/__init__.py       2021-08-20 16:28:49.000000000 
+0200
@@ -35,7 +35,9 @@
                                plugin.run(query)
                                sys.exit()
 
-       def show_plugins(self, indent=''):
+       def get_plugin_string(self, indent=''):
+               plugins = ""
                for plugin in self.plugins:
                        description = plugin.description.replace("\n", "\n" + 
(" "*16) + "  ")
-                       print("%s%-16s  %s" % (indent, plugin.main_query, 
description))
+                       plugins += "%s%-16s  %s\n" % (indent, 
plugin.main_query, description)
+               return plugins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/brave.py 
new/opi-2.2.0/opi/plugins/brave.py
--- old/opi-2.1.1/opi/plugins/brave.py  2021-08-10 11:30:42.000000000 +0200
+++ new/opi-2.2.0/opi/plugins/brave.py  2021-08-20 16:28:49.000000000 +0200
@@ -19,5 +19,9 @@
                        gpgkey = 
'https://brave-browser-rpm-release.s3.brave.com/brave-core.asc'
                )
 
+               # prevent post install script from messing with our repos
+               subprocess.call(['sudo', 'rm', '-f', 
'/etc/default/brave-browser'])
+               subprocess.call(['sudo', 'touch', '/etc/default/brave-browser'])
+
                opi.install_packages(['brave-browser'])
                opi.ask_keep_repo('brave-browser')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/megasync.py 
new/opi-2.2.0/opi/plugins/megasync.py
--- old/opi-2.1.1/opi/plugins/megasync.py       1970-01-01 01:00:00.000000000 
+0100
+++ new/opi-2.2.0/opi/plugins/megasync.py       2021-08-20 16:28:49.000000000 
+0200
@@ -0,0 +1,39 @@
+import opi
+
+from opi.plugins import BasePlugin
+from shutil import which
+
+class MEGAsync(BasePlugin):
+       main_query = "megasync"
+       description = "Mega Desktop App"
+       queries = ('megasync', 'megasyncapp')
+
+       @classmethod
+       def run(cls, query):
+               if not opi.ask_yes_or_no("Do you want to install MEGAsync from 
MEGAsync repository?", 'y'):
+                       return
+
+               opi.add_repo(
+                       filename = 'megasync',
+                       name = 'MEGAsync',
+                       url = 
'https://mega.nz/linux/MEGAsync/openSUSE_Tumbleweed/',
+                       gpgkey = 
'https://mega.nz/linux/MEGAsync/openSUSE_Tumbleweed/repodata/repomd.xml.key'
+               )
+
+               packages = ['megasync']
+
+               if which('nautilus'):
+                       packages.append('nautilus-megasync')
+
+               if which('nemo'):
+                       packages.append('nemo-megasync')
+               
+               if which('thunar'):
+                       packages.append('thunar-megasync')
+               
+               if which('dolphin'):
+                       packages.append('dolphin-megasync')
+
+               opi.install_packages(packages)
+
+               opi.ask_keep_repo('megasync')
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/ms_edge.py 
new/opi-2.2.0/opi/plugins/ms_edge.py
--- old/opi-2.1.1/opi/plugins/ms_edge.py        2021-08-10 11:30:42.000000000 
+0200
+++ new/opi-2.2.0/opi/plugins/ms_edge.py        1970-01-01 01:00:00.000000000 
+0100
@@ -1,27 +0,0 @@
-import opi
-from opi.plugins import BasePlugin
-import subprocess
-
-class MSEdge(BasePlugin):
-       main_query = "msedge"
-       description = "Microsoft Edge Dev"
-       queries = ('microsoftedge', 'msedge', 'edge')
-
-       @classmethod
-       def run(cls, query):
-               if not opi.ask_yes_or_no("Do you want to install Edge from 
Microsoft repository?", 'y'):
-                       return
-
-               opi.add_repo(
-                       filename = 'microsoft-edge',
-                       name = 'MS Edge',
-                       url = 'https://packages.microsoft.com/yumrepos/edge',
-                       gpgkey = 
'https://packages.microsoft.com/keys/microsoft.asc'
-               )
-
-               # tell rpm post script not to mess with our repos
-               subprocess.call(['sudo', 'rm', '-f', 
'/etc/default/microsoft-edge-dev'])
-               subprocess.call(['sudo', 'touch', 
'/etc/default/microsoft-edge-dev'])
-
-               opi.install_packages(['microsoft-edge-dev'])
-               opi.ask_keep_repo('microsoft-edge')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/ms_edge_beta.py 
new/opi-2.2.0/opi/plugins/ms_edge_beta.py
--- old/opi-2.1.1/opi/plugins/ms_edge_beta.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/opi-2.2.0/opi/plugins/ms_edge_beta.py   2021-08-20 16:28:49.000000000 
+0200
@@ -0,0 +1,28 @@
+import opi
+import subprocess
+
+from opi.plugins import BasePlugin
+
+class MSEdgeBeta(BasePlugin):
+       main_query = "msedge-beta"
+       description = "Microsoft Edge Beta"
+       queries = ('microsoft-edge-beta', 'msedge-beta', 'edge-beta')
+
+       @classmethod
+       def run(cls, query):
+               if not opi.ask_yes_or_no("Do you want to install Microsoft Edge 
Beta from Microsoft repository?", 'y'):
+                       return
+
+               opi.add_repo(
+                       filename = 'microsoft-edge',
+                       name = 'Microsoft Edge',
+                       url = 'https://packages.microsoft.com/yumrepos/edge',
+                       gpgkey = 
'https://packages.microsoft.com/keys/microsoft.asc'
+               )
+
+               # prevent post install script from messing with our repos
+               subprocess.call(['sudo', 'rm', '-f', 
'/etc/default/microsoft-edge-beta'])
+               subprocess.call(['sudo', 'touch', 
'/etc/default/microsoft-edge-beta'])
+
+               opi.install_packages(['microsoft-edge-beta'])
+               opi.ask_keep_repo('microsoft-edge')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/plugins/ms_edge_dev.py 
new/opi-2.2.0/opi/plugins/ms_edge_dev.py
--- old/opi-2.1.1/opi/plugins/ms_edge_dev.py    1970-01-01 01:00:00.000000000 
+0100
+++ new/opi-2.2.0/opi/plugins/ms_edge_dev.py    2021-08-20 16:28:49.000000000 
+0200
@@ -0,0 +1,28 @@
+import opi
+import subprocess
+
+from opi.plugins import BasePlugin
+
+class MSEdgeDev(BasePlugin):
+       main_query = "msedge-dev"
+       description = "Microsoft Edge Dev"
+       queries = ('microsoft-edge-dev', 'msedge-dev', 'edge-dev')
+
+       @classmethod
+       def run(cls, query):
+               if not opi.ask_yes_or_no("Do you want to install Microsoft Edge 
Dev from Microsoft repository?", 'y'):
+                       return
+
+               opi.add_repo(
+                       filename = 'microsoft-edge',
+                       name = 'Microsoft Edge',
+                       url = 'https://packages.microsoft.com/yumrepos/edge',
+                       gpgkey = 
'https://packages.microsoft.com/keys/microsoft.asc'
+               )
+
+               # prevent post install script from messing with our repos
+               subprocess.call(['sudo', 'rm', '-f', 
'/etc/default/microsoft-edge-dev'])
+               subprocess.call(['sudo', 'touch', 
'/etc/default/microsoft-edge-dev'])
+
+               opi.install_packages(['microsoft-edge-dev'])
+               opi.ask_keep_repo('microsoft-edge')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/opi-2.1.1/opi/version.py new/opi-2.2.0/opi/version.py
--- old/opi-2.1.1/opi/version.py        2021-08-10 11:30:42.000000000 +0200
+++ new/opi-2.2.0/opi/version.py        2021-08-20 16:28:49.000000000 +0200
@@ -1 +1 @@
-__version__ = '2.1.1'
+__version__ = '2.2.0'

Reply via email to