21 lines
802 B
Python

from qgis.core import QgsApplication
def gitea():
file_url = QgsApplication.qgisSettingsDirPath()+'QGIS/QGIS3.ini'
recherche_1 = 'plugin_repositories\\github\\url=https://github.com/CEN-Rhone-Alpes/Plugin_QGIS/releases/latest/download/plugins.xml'
replace_1 = 'plugin_repositories\\gitea\\url=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
recherche_2 = 'github'
replace_2 = 'gitea'
# Read in the file
with open(file_url, 'r') as file:
filedata = file.read()
# Replace the target string
filedata = filedata.replace(recherche_1, replace_1)
filedata = filedata.replace(recherche_2, replace_2)
# Write the file out again
with open(file_url, 'w') as file:
file.write(filedata)