def checkVersion(major, minor): """ Vérifie si la base de données reste compatible. Un changement de version majeur implique une mise à jour en cas de base de donnée ancienne. Un changmeent de version mineur n'implique pas de changement de structure de la base de données. """ cursor.execute('''select * from version''') values=cursor.fetchone() if values == None: # pas de version existante, on la crée cursor.execute('''insert into version values (?,?)''', (version.major(), version.minor())) else: major, minor = values if major < version.major(): raise KeyError("The database version is too old!") elif minor < version.minor(): cursor.execute("""update version set minor=? where major=?""", (version.minor(), version.major())) database.commit()
def openDb(): """ Ouverture de la base de données de l'application, et création si nécessaire. @return une instance de base de données sqlite3 """ global database, cursor dir=os.path.expanduser(userShareDir) if not os.path.isdir(dir): subprocess.call("mkdir %s" %dir, shell=True) database = sqlite3.connect(os.path.join(dir,"db")) cursor=database.cursor() cursor.execute('''create table if not exists owners (stickid text, uuid text, tatoo text, student text)''') cursor.execute('''create table if not exists version (major text, minor text)''') cursor.execute('''create table if not exists preferences (checkable int, mv int, schoolfile text, workdir text, manfile text)''') database.commit() checkVersion(version.major(), version.minor())
# General information about the project. project = u'RTEMS Documentation Project' copyright = u'1988, 2020 RTEMS Project and contributors' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = rtems_version.version() # The full version, including alpha/beta/rc tags. release = rtems_version.string() major = rtems_version.major() minor = rtems_version.minor() revision = rtems_version.revision() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = []
def __init__(self, parent=None): """ Le constructeur """ QDialog.__init__(self, parent) from Ui_help import Ui_Aide self.ui=Ui_Aide() self.ui.setupUi(self) self.ui.labelVersion.setText(QApplication.translate("Main","Version numéro {major}.{minor}",None).format(major=version.major(), minor=version.minor())) self.loadBrowsers(_dir("help"),self.parent().locale) self.ui.closeButton.clicked.connect(self.close)