Python sqlite3.version() Examples

The following are 30 code examples of sqlite3.version(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlite3 , or try the search function .
Example #1
Source File: parser_db.py    From guasap-whatsapp-foresincs-tool with GNU General Public License v3.0 6 votes vote down vote up
def analyze_db():
	conn = sqlite3.connect('WhatsappDB/msgstore.db')	
	cursor = conn.cursor()
	rows=list()

	print 'Module Version ',sqlite3.version
	print 'Library Version ',sqlite3.sqlite_version
	print ""

	for row in cursor.execute('SELECT * FROM messages where edit_version=7 and key_from_me = 1 ORDER BY _id'):
		row_date=str(row[7])
		if len(row_date)>10:
			row_date = row_date[:len(row_date)-3]
		row_date=datetime.datetime.fromtimestamp(int(row_date)).strftime('%Y-%m-%d %H:%M:%S')
		text = "Numero de telefono de whatsapp borrado [>] "+ str(str(row[1]).split("@")[0]) + "\nTimestamp [>] "+row_date
		print text
		rows.append(text)

	cursor.close()
	conn.close()
	return rows 
Example #2
Source File: sqldata.py    From coveragepy with Apache License 2.0 6 votes vote down vote up
def _create_db(self):
        """Create a db file that doesn't exist yet.

        Initializes the schema and certain metadata.
        """
        if self._debug.should('dataio'):
            self._debug.write("Creating data file {!r}".format(self._filename))
        self._dbs[get_thread_id()] = db = SqliteDb(self._filename, self._debug)
        with db:
            db.executescript(SCHEMA)
            db.execute("insert into coverage_schema (version) values (?)", (SCHEMA_VERSION,))
            db.executemany(
                "insert into meta (key, value) values (?, ?)",
                [
                    ('sys_argv', str(getattr(sys, 'argv', None))),
                    ('version', __version__),
                    ('when', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')),
                ]
            ) 
Example #3
Source File: sqldata.py    From coveragepy with Apache License 2.0 6 votes vote down vote up
def _read_db(self):
        """Read the metadata from a database so that we are ready to use it."""
        with self._dbs[get_thread_id()] as db:
            try:
                schema_version, = db.execute_one("select version from coverage_schema")
            except Exception as exc:
                raise CoverageException(
                    "Data file {!r} doesn't seem to be a coverage data file: {}".format(
                        self._filename, exc
                    )
                )
            else:
                if schema_version != SCHEMA_VERSION:
                    raise CoverageException(
                        "Couldn't use data file {!r}: wrong schema: {} instead of {}".format(
                            self._filename, schema_version, SCHEMA_VERSION
                        )
                    )

            for row in db.execute("select value from meta where key = 'has_arcs'"):
                self._has_arcs = bool(int(row[0]))
                self._has_lines = not self._has_arcs

            for path, file_id in db.execute("select path, id from file"):
                self._file_map[path] = file_id 
Example #4
Source File: sqldata.py    From coveragepy with Apache License 2.0 6 votes vote down vote up
def dumps(self):
        """Serialize the current data to a byte string.

        The format of the serialized data is not documented. It is only
        suitable for use with :meth:`loads` in the same version of
        coverage.py.

        Returns:
            A byte string of serialized data.

        .. versionadded:: 5.0

        """
        if self._debug.should('dataio'):
            self._debug.write("Dumping data from data file {!r}".format(self._filename))
        with self._connect() as con:
            return b'z' + zlib.compress(to_bytes(con.dump())) 
Example #5
Source File: sqldata.py    From coveragepy with Apache License 2.0 6 votes vote down vote up
def sys_info(cls):
        """Our information for `Coverage.sys_info`.

        Returns a list of (key, value) pairs.

        """
        with SqliteDb(":memory:", debug=NoDebugging()) as db:
            temp_store = [row[0] for row in db.execute("pragma temp_store")]
            compile_options = [row[0] for row in db.execute("pragma compile_options")]

        return [
            ('sqlite3_version', sqlite3.version),
            ('sqlite3_sqlite_version', sqlite3.sqlite_version),
            ('sqlite3_temp_store', temp_store),
            ('sqlite3_compile_options', compile_options),
        ] 
Example #6
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def check13_pyicu(self):
        '''PyICU'''
        self.append_text("\n")
        # Start check

        try:
            import PyICU
            try:
                pyicu_str = PyICU.VERSION
                icu_str = PyICU.ICU_VERSION
            except Exception:  # any failure to 'get' the version
                pyicu_str = 'unknown version'
                icu_str = 'unknown version'

        except ImportError:
            pyicu_str = 'not found'
            icu_str = 'not found'

        result = "* PyICU " + pyicu_str + "(ICU " + icu_str + ")"
        # End check
        self.append_text(result) 
Example #7
Source File: index_fastq.py    From EdwardsLab with MIT License 6 votes vote down vote up
def connect_to_db(dbname, verbose=False):
    """
    Connect to the database
    :param dbname: the database file name
    :param verbose: print addtional output
    :return: the database connection
    """

    try:
        conn = sqlite3.connect(dbname)
    except sqlite3.Error as e:
        print(e)
        sys.exit(-1)

    if verbose:
        sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))

    return conn 
Example #8
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def check7_sqlite3(self):
        '''sqlite3
        #TODO need to add to required section readme

        https://stackoverflow.com/a/1546162
        '''
        self.append_text("\n")
        # Start check
        #SQLITE_MIN_VERSION = (0, 0, 0)

        try:
            import sqlite3
            # sqlite3.version - pysqlite version
            sqlite3_py_version_str = sqlite3.version
            # sqlite3.sqlite_version - sqlite version
            sqlite3_version_str = sqlite3.sqlite_version
        except ImportError:
            sqlite3_version_str = 'not found'
            sqlite3_py_version_str = 'not found'

        result = ("* SQLite Database library (sqlite3: " +
                  sqlite3_version_str + ") (Python-sqlite3: " +
                  sqlite3_py_version_str + ")")
        # End check
        self.append_text(result) 
Example #9
Source File: sqlite_taxon.py    From EdwardsLab with MIT License 6 votes vote down vote up
def connect_to_db(dbname, verbose=False):
    """
    Connect to the database
    :param dbname: the database file name
    :param verbose: print addtional output
    :return: the database connection
    """

    try:
        if verbose:
            sys.stderr.write("Connecting to {}\n".format(os.path.join(defaultdir, dbname)))
        conn = sqlite3.connect(os.path.join(defaultdir, dbname))
    except sqlite3.Error as e:
        sys.stderr.write("ERROR Creating database: {}\n".format(os.path.join(defaultdir, dbname)))
        sys.stderr.write(e)
        sys.exit(-1)

    if verbose:
        sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))

    return conn 
Example #10
Source File: load_from_database.py    From EdwardsLab with MIT License 6 votes vote down vote up
def connect_to_db(dbname, verbose=False):
    """
    Connect to the database
    :param dbname: the database file name
    :param verbose: print addtional output
    :return: the database connection
    """

    global conn
    if conn:
        return conn

    try:
        conn = sqlite3.connect(dbname)
    except sqlite3.Error as e:
        print(e)
        sys.exit(-1)

    if verbose:
        sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))

    return conn 
Example #11
Source File: load_rapsearch_sqlite.py    From EdwardsLab with MIT License 6 votes vote down vote up
def createdb(db, verbose=False):
    """
    Create the database connection
    :param db:
    :return:
    """

    try:
        conn = sqlite3.connect(db)
    except sqlite3.Error as e:
        sys.stderr.write("ERROR Creating database: {}\n".format(db))
        sys.stderr.write(e)
        sys.exit(-1)

    if verbose:
        sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))

    return conn 
Example #12
Source File: parse_biochemistry.py    From EdwardsLab with MIT License 6 votes vote down vote up
def createdb(db, verbose=False):
    """
    Create the database connection
    :param db:
    :return:
    """

    try:
        conn = sqlite3.connect(db)
    except sqlite3.Error as e:
        sys.stderr.write("ERROR Creating database: {}\n".format(db))
        sys.stderr.write(e)
        sys.exit(-1)

    if verbose:
        sys.stderr.write("Connected to database: {}\n".format(sqlite3.version))

    return conn 
Example #13
Source File: test_sqlite.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def load_tests(*args):
    if test.support.verbose:
        print("test_sqlite: testing with version",
              "{!r}, sqlite_version {!r}".format(sqlite3.version,
                                                 sqlite3.sqlite_version))
    return unittest.TestSuite([dbapi.suite(), types.suite(),
                               userfunctions.suite(),
                               factory.suite(), transactions.suite(),
                               hooks.suite(), regression.suite(),
                               dump.suite()]) 
Example #14
Source File: sqlite.py    From gprime with GNU General Public License v2.0 5 votes vote down vote up
def get_summary(cls):
        """
        Return a dictionary of information about this database backend.
        """
        summary = {
            "DB-API version": "2.0",
            "Database SQL type": cls.__name__,
            "Database SQL module": "sqlite3",
            "Database SQL Python module version": sqlite3.version,
            "Database SQL module version": sqlite3.sqlite_version,
            "Database SQL module location": sqlite3.__file__,
        }
        return summary 
Example #15
Source File: test_sqlite.py    From android_universal with MIT License 5 votes vote down vote up
def load_tests(*args):
    if test.support.verbose:
        print("test_sqlite: testing with version",
              "{!r}, sqlite_version {!r}".format(sqlite3.version,
                                                 sqlite3.sqlite_version))
    return unittest.TestSuite([dbapi.suite(), types.suite(),
                               userfunctions.suite(),
                               factory.suite(), transactions.suite(),
                               hooks.suite(), regression.suite(),
                               dump.suite(),
                               backup.suite()]) 
Example #16
Source File: test_database.py    From lbry-sdk with MIT License 5 votes vote down vote up
def test_unhandled_sqlite_misuse(self):
        # test SQLITE_MISUSE being incorrectly raised as a param 0 binding error
        attempts = 0
        python_version = sys.version.split('\n')[0].rstrip(' ')

        try:
            while attempts < self.max_misuse_attempts:
                f1 = asyncio.wrap_future(
                    self.loop.run_in_executor(
                        self.executor, self.db.executemany, "update test1 set val='derp' where id=?",
                        ((str(i),) for i in range(2))
                    )
                )
                f2 = asyncio.wrap_future(
                    self.loop.run_in_executor(
                        self.executor, self.db.executemany, "update test2 set val='derp' where id=?",
                        ((str(i),) for i in range(2))
                    )
                )
                attempts += 1
                await asyncio.gather(f1, f2)
            print(f"\nsqlite3 {sqlite3.version}/python {python_version} "
                  f"did not raise SQLITE_MISUSE within {attempts} attempts of the race condition")
            self.assertTrue(False, 'this test failing means either the sqlite race conditions '
                                   'have been fixed in cpython or the test max_attempts needs to be increased')
        except sqlite3.InterfaceError as err:
            self.assertEqual(str(err), "Error binding parameter 0 - probably unsupported type.")
        print(f"\nsqlite3 {sqlite3.version}/python {python_version} raised SQLITE_MISUSE "
              f"after {attempts} attempts of the race condition") 
Example #17
Source File: test_database.py    From lbry-sdk with MIT License 5 votes vote down vote up
def get_version(self):
        with sqlite3.connect(self.path) as conn:
            versions = conn.execute('select version from version').fetchall()
            assert len(versions) == 1
            return versions[0][0] 
Example #18
Source File: test_sqlite.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def load_tests(*args):
    if test.support.verbose:
        print("test_sqlite: testing with version",
              "{!r}, sqlite_version {!r}".format(sqlite3.version,
                                                 sqlite3.sqlite_version))
    return unittest.TestSuite([dbapi.suite(), types.suite(),
                               userfunctions.suite(),
                               factory.suite(), transactions.suite(),
                               hooks.suite(), regression.suite(),
                               dump.suite()]) 
Example #19
Source File: test_sqlite.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def load_tests(*args):
    if test.support.verbose:
        print("test_sqlite: testing with version",
              "{!r}, sqlite_version {!r}".format(sqlite3.version,
                                                 sqlite3.sqlite_version))
    return unittest.TestSuite([dbapi.suite(), types.suite(),
                               userfunctions.suite(),
                               factory.suite(), transactions.suite(),
                               hooks.suite(), regression.suite(),
                               dump.suite()]) 
Example #20
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check31_EditExifMetadata(self):
        '''Edit Image Exif Metadata -

        requires:
        * PIL (Pillow)
        * pyexiv2  ( 0.2.0 )
        * exiv2

        https://github.com/gramps-project/addons-source/tree/master/EditExifMetadata
        '''
        self.append_text("\n")
        self.render_text("""<b>11. <a href="https://gramps-project.org/"""
                         """wiki/index.php?title=Edit_Image_Exif_Metadata">"""
                         """Addon:Edit Image Exif Metadata</a> :</b> """)

        # Start check
        self.check17_pillow()
        '''
        # validate that pyexiv2 is installed and its version...
        import pyexiv2

        # v0.1 has a different API to v0.2 and above
        if hasattr(pyexiv2, 'version_info'):
            OLD_API = False
        else:
        # version_info attribute does not exist prior to v0.2.0
            OLD_API = True

        # validate the exiv2 is installed and its executable
        system_platform = os.sys.platform
        if system_platform == "win32":
            EXIV2_FOUND = "exiv2.exe" if search_for("exiv2.exe") else False
        else:
            EXIV2_FOUND = "exiv2" if search_for("exiv2") else False
        if not EXIV2_FOUND:
            msg = 'You must have exiv2 and its development file installed.'
            raise SystemExit(msg)
        '''
        # End checks
        self.append_text(" ")
        self.check_gexiv2() 
Example #21
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check1_python(self):
        '''Check python version Gramps is currently running with against min
        version required

        #TODO - does not handle an older version of Gramps using python 2 on
        that a system that has python 3 installed (same for each of the other
        test)
        '''
        # Start check
        MIN_PYTHON_VERSION = (3, 3, 0)
        min_py_str = verstr(MIN_PYTHON_VERSION)

        # version to check against
        # Gramps running version of python
        py_str = '%d.%d.%d' % sys.version_info[:3]
        check1 = "* Python "

        if not sys.version_info >= MIN_PYTHON_VERSION:
            #print("Failed")
            messagefailed1 = " (Requires version "
            messagefailed3 = " or greater installed.)\n"

            messagefailed = messagefailed1 + min_py_str + messagefailed3

            result = check1 + py_str + messagefailed
        else:
            #print("Success")
            messagesuccess1 = " (Success version "
            messagesuccess3 = " or greater installed.)\n"

            messagesuccess = messagesuccess1 + min_py_str + messagesuccess3

            result = check1 + py_str + messagesuccess
        # End check
        self.append_text(result) 
Example #22
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check28_webconnectpacks(self):
        '''Webconnect Pack - needs the gramps addon : "libwebconnect"
            installed at the same time.

        libwebconnect is the support Library for web site collections.
        '''
        self.append_text("\n")
        self.render_text("""<b>08. <a href="https://gramps-project.org/wiki/"""
                         """index.php?title=Web_Connect_Pack">"""
                         """Addon:Webconnect Pack</a> :</b> """)
        # Start check

        try:
            import libwebconnect
            LIBWEBCONNECT_test = True
            LIBWEBCONNECT_result = "Installed"
            # TODO add version addon string.
        except Exception:
            LIBWEBCONNECT_test = False
            LIBWEBCONNECT_result = "Not found"

        if LIBWEBCONNECT_test:
            result = "(libwebconnect : " + LIBWEBCONNECT_result + ")(Success)"
        else:
            result = ("(libwebconnect : " + LIBWEBCONNECT_result +
                      ")(Requires the gramps addon listed under 'Plugin lib')")
        # End check
        self.append_text(result)
        #self.append_text("\n") 
Example #23
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check22_graphview(self):
        '''
        Graph View - Requires: PyGoocanvas and Goocanvas and
        graphviz (python-pygoocanvas, gir1.2-goocanvas-2.0)
        '''
        self.append_text("\n")
        self.render_text("""<b>02. <a href="https://gramps-project.org/wiki"""
                         """/index.php?title=Graph_View">"""
                         """Addon:Graph View</a> :</b> """)
        # Start check

        # check for GooCanvas
        try:
            try:
                gi.require_version('GooCanvas', '2.0')
            except Exception:
                print("Why, when same code works in Graphview")
            from gi.repository import GooCanvas
            goocanvas_ver = str(GooCanvas._version)
            #print("GooCanvas version:" + goocanvas_ver)
        except ImportError:
            goocanvas_ver = "Not installed"

        result = "(GooCanvas:" + goocanvas_ver + ")(PyGoocanvas: TBD?)"
        # End check
        self.append_text(result)
        self.append_text("(")
        self.check12_graphviz()
        self.append_text(")") 
Example #24
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check19_geocodeglib(self):
        '''geocodeglib
        # added to gramps master v5.1.0
        #TODO: add to gramps-v check

        https://github.com/gramps-project/gramps/blob/maintenance/gramps50/gramps/plugins/lib/maps/placeselection.py
        '''
        self.append_text("\n")
        # Start check
        geocodeglib_min_ver = "1.0"

        try:
            gi.require_version('GeocodeGlib', '1.0')
            from gi.repository import GeocodeGlib
            geocodeglib_ver = str(GeocodeGlib._version)
            GEOCODEGLIB = True
        except Exception:
            geocodeglib_ver = "Not found"
            GEOCODEGLIB = False

        if GEOCODEGLIB:
            result = ("* geocodeglib " + geocodeglib_ver +
                      " (Success version " + geocodeglib_min_ver +
                      " or greater installed.)")
        else:
            result = ("* geocodeglib " + geocodeglib_ver +
                      " (Requires version " + geocodeglib_min_ver +
                      " or greater installed.)")

        # End check
        self.append_text(result) 
Example #25
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check17_pillow(self):
        '''PILLOW
        Allows Production of jpg images from non-jpg images in LaTeX documents

        #TODO prculley mentions that : And PIL (Pillow) is also used by the
        main Gramps ([]narrativeweb and []other reports for image cropping)
        as well as [x]editexifmetadata and the
        new [x]latexdoc type addons (genealogytree).

        #TODO add check for PILLOW to "gramps -v"  section

        https://github.com/gramps-project/gramps/blob/maintenance/gramps50/gramps/plugins/docgen/latexdoc.py
        '''
        #self.append_text("\n")
        # Start check

        try:
            import PIL
            # from PIL import Image
            try:
                pil_ver = PIL.__version__
            except Exception:
                try:
                    pil_ver = str(PIL.PILLOW_VERSION)
                except Exception:
                    try:
                        #print(dir(PIL))
                        pil_ver = str(PIL.VERSION)
                    except Exception:
                        pil_ver = "Installed but does not supply version"
        except ImportError:
            pil_ver = "Not found"

        result = "(PILLOW " + pil_ver + ")"
        # End check
        self.append_text(result) 
Example #26
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check14_ghostscript(self):
        '''Ghostscript - need to add to strongly recomended or optional?
        section of readme

        Q:What does it do ?
        A:
        https://www.gramps-project.org/wiki/index.php?title=Gramps_5.0_Wiki_Manual_-_Reports_-_part_5#Graphviz_Layout
        *Number of Horizontal Pages: (1 default) Graphviz can create very
         large graphs by spreading the graph across a rectangular array of
         pages. This controls the number of pages in the array horizontally.
         Only valid for dot and pdf via Ghostscript.
        *Number of Vertical Pages: (1 default) Graphviz can create very large
         graphs by spreading the graph across a rectangular array of pages.
         This controls the number of pages in the array vertically.
         Only valid for dot and pdf via Ghostscript.
        '''
        self.append_text("\n")
        # Start check

        try:
            if win():
                try:
                    gsvers_str = Popen(['gswin32c', '--version'],
                                       stdout=PIPE).communicate(input=None)[0]
                except Exception:
                    gsvers_str = Popen(['gswin64c', '--version'],
                                       stdout=PIPE).communicate(input=None)[0]
            else:
                gsvers_str = Popen(['gs', '--version'],
                                   stdout=PIPE).communicate(input=None)[0]
            if isinstance(gsvers_str, bytes) and sys.stdin.encoding:
                gsvers_str = gsvers_str.decode(sys.stdin.encoding)
            if gsvers_str:
                gsvers_str = gsvers_str.replace('\n', '')
        except Exception:
            gsvers_str = 'Ghostscript not in system PATH'

        result = "* Ghostscript " + gsvers_str
        # End check
        self.append_text(result) 
Example #27
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check12_graphviz(self):
        '''Graphviz

        Needs the liblasi library with utf-8 support to create ps/ps2 output

        GRAPHVIZ_MIN_VER = (2, 28)


        https://github.com/Alexpux/MINGW-packages/issues/737#issuecomment-147185667
        # bpisoj commented that Gramps needs a version of Graphviz that :
        [needs additional]...library be added to msys2-mingw stack as
        libann, libgts and liblasi?
        I am interested in last one as only that support utf-8 characters
        in ps/ps2 output.
        '''
        #self.append_text("\n")
        # Start check

        try:
            dotversion_str = Popen(['dot', '-V'],
                                   stderr=PIPE).communicate(input=None)[1]
            if isinstance(dotversion_str, bytes) and sys.stdin.encoding:
                dotversion_str = dotversion_str.decode(sys.stdin.encoding)
            if dotversion_str:
                dotversion_str = dotversion_str.replace('\n', '')[23:27]
        except Exception:
            dotversion_str = 'Graphviz not in system PATH'

        result = "Graphviz " + dotversion_str
        # End check
        self.append_text(result) 
Example #28
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def check11_osmgpsmap(self):
        '''osmgpsmap'''
        # Start check
        OSMGPSMAP_MIN_VERSION = (1, 0)
        OSMGPSMAP_FOUND = False

        try:
            from gi import Repository
            repository = Repository.get_default()
            if repository.enumerate_versions("OsmGpsMap"):
                gi.require_version('OsmGpsMap', '1.0')
                from gi.repository import OsmGpsMap as osmgpsmap
                try:
                    osmgpsmap_str = osmgpsmap._version
                    OSMGPSMAP_FOUND = True
                except Exception:  # any failure to 'get' the version
                    osmgpsmap_str = 'unknown version'
            else:
                osmgpsmap_str = 'not found'

        except ImportError:
            osmgpsmap_str = 'not found'

        if OSMGPSMAP_FOUND:
            result = ("* osmgpsmap " + osmgpsmap_str + " (Success version " +
                      verstr(OSMGPSMAP_MIN_VERSION) +
                      " or greater installed.)")
        else:
            result = ("* osmgpsmap " + osmgpsmap_str + " (Requires version " +
                      verstr(OSMGPSMAP_MIN_VERSION) + " or greater)")

        # End check
        self.append_text(result) 
Example #29
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 4 votes vote down vote up
def check16_rcs(self):
        '''GNU Revision Control System (RCS)

        The GNU Revision Control System (RCS) can be used to manage multiple
        revisions of your family trees. Only rcs is needed, NO python bindings
        are required. See info at
        https://gramps-project.org/wiki/index.php?title=Gramps_5.0_Wiki_Manual_-_Manage_Family_Trees#Archiving_a_Family_Tree

        #TODO add check for rcs to "gramps -v"  section

        https://github.com/gramps-project/gramps/blob/maintenance/gramps50/gramps/gui/dbman.py

        # (check if on windows and ignore?)

        $ rcs -V
        RCS version 5.7.1

        $ rcs --version
        rcs (GNU RCS) 5.9.4
        Copyright (C) 2010-2015 Thien-Thi Nguyen
        Copyright (C) 1990-1995 Paul Eggert
        Copyright (C) 1982,1988,1989 Walter F. Tichy, Purdue CS
        License GPLv3+: GNU GPL version 3 or later
        <http://gnu.org/licenses/gpl.html>
        This is free software: you are free to change and redistribute it.
        There is NO WARRANTY, to the extent permitted by law.
        '''
        self.append_text("\n")
        # Start check
        RCS_MIN_VER = (5, 9, 4)
        rcs_ver_str = verstr(RCS_MIN_VER)
        #print("os.environ: %s " % os.environ)
        try:
            if win():
                _RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
                RCS_RESULT = "installed"
                #print("rcs -V : " + os.system("rcs -V"))
                if _RCS_FOUND and "TZ" not in os.environ:
                    # RCS requires the "TZ" variable be set.
                    os.environ["TZ"] = str(time.timezone)
            else:
                _RCS_FOUND = os.system("rcs -V >/dev/null 2>/dev/null") == 0
                #print("xx rcs -V : " + os.system("rcs -V"))
                RCS_RESULT = "installed"
        except Exception:
            _RCS_FOUND = False
            RCS_RESULT = "Not found"

        #Test
        if _RCS_FOUND:  # TODO actually test for version
            result = ("* rcs %s TBD (Success version %s or greater installed."
                      " If not on Microsoft Windows)" %
                      (RCS_RESULT, rcs_ver_str))
        else:
            result = ("* rcs %s TBD (Requires version %s or greater installed."
                      " If not on Microsoft Windows)" %
                      (RCS_RESULT, rcs_ver_str))

        # End check
        self.append_text(result) 
Example #30
Source File: PrerequisitesCheckerGramplet.py    From addons-source with GNU General Public License v2.0 4 votes vote down vote up
def gramps_version(self):
        '''Report Currently installed Gramps Version

        #if current < installed version then mention current version?
        #if current == installed version then don't mention current version?
        #if current > installed version then don't mention current version
                                        running test or development version?

        https://gramps-project.org/wiki/index.php?title=Previous_releases_of_Gramps
        '''
        self.append_text("\n")
        # Start check
        LATEST_GRAMPS_VERSION = (5, 1, 2)
        LATEST_GRAMPS_DATE = "2020-01-10"
        latest_release_message = ("Gramps " + verstr(LATEST_GRAMPS_VERSION) +
                                  "  released " + LATEST_GRAMPS_DATE +
                                  " is the most current version.\n")

        try:
            try:
                from gramps.gen.const import VERSION, VERSION_TUPLE
                gramps_str = VERSION
                gramps_ver = VERSION_TUPLE
            except ImportError:
                # Gramps 3.x series
                from const import VERSION, VERSION_TUPLE
                gramps_str = VERSION
                gramps_ver = VERSION_TUPLE
        except ImportError:
            gramps_str = 'not found'

        # Test
        if not gramps_ver >= LATEST_GRAMPS_VERSION:
            # print("Failed")
            result = ("You have Gramps %s. Please make a backup and then "
                      "upgrade.\n%s" % (gramps_str, latest_release_message))
        else:
            if not gramps_ver == LATEST_GRAMPS_VERSION:
                result = ("You have Gramps %s installed; an unreleased "
                          "development version. Thank you for contributing and"
                          " testing; please report any issues. Backups are "
                          "your friend.\n" % (gramps_str))
                # print(gramps_ver)
            else:
                # print("Success")
                # TODO add further check that this is true?
                result = ("You have Gramps %s. Congratulations you have the"
                          " current version.\n" % (gramps_str))

        # End check
        self.render_text(result)
        #self.append_text(result)

    #Requirements