Skip to content
Snippets Groups Projects
Commit 92a0de14 authored by Frede H's avatar Frede H :speech_balloon:
Browse files

Merge remote-tracking branch 'upstream/master'

parents e3d34889 57e25bf3
No related branches found
No related tags found
No related merge requests found
# Credits
## Development Lead
- Roland Singer <roland@manjaro.org>
- Esclapion
- philm
- Ramon Buldó <rbuldo@gmail.com>
- Hugo Posnic <huluti@manjaro.org>
## Contributors
- Frede Hundewadt
Thank you all! ;)
......@@ -32,6 +32,10 @@ pacman-mirrors could always use more documentation, whether as part of the
official pacman-mirrors docs, in docstrings, or even on the web in blog posts,
articles, and such.
### Translations
Help us to ship pacman-mirrors in your language by helping our translators on [Transifex](https://www.transifex.com/manjarolinux/manjaro-pacman-mirrors/dashboard/).
### Submit Feedback
The best way to send feedback is to file an issue at https://github.com/manjaro/pacman-mirrors/issues.
......
......@@ -11,8 +11,8 @@ msgid ""
msgstr ""
"Project-Id-Version: manjaro-pacman-mirrors\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-02-02 21:13+0100\n"
"PO-Revision-Date: 2017-02-10 16:35+0000\n"
"POT-Creation-Date: 2017-02-20 15:44+0100\n"
"PO-Revision-Date: 2017-03-06 20:47+0000\n"
"Last-Translator: Hugo Posnic <huluti@manjaro.org>\n"
"Language-Team: French (http://www.transifex.com/manjarolinux/manjaro-pacman-mirrors/language/fr/)\n"
"MIME-Version: 1.0\n"
......@@ -22,250 +22,254 @@ msgstr ""
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: pacman_mirrors/txt.py:34
#: pacman_mirrors/txt.py:31
msgid "Error"
msgstr "Erreur"
#: pacman_mirrors/txt.py:35
#: pacman_mirrors/txt.py:32
msgid "Info"
msgstr "Info"
#: pacman_mirrors/txt.py:36
#: pacman_mirrors/txt.py:33
msgid "Warning"
msgstr "Attention"
#: pacman_mirrors/txt.py:38
#: pacman_mirrors/txt.py:35
msgid "Timeout"
msgstr "Délai expiré"
#: pacman_mirrors/txt.py:39
#: pacman_mirrors/txt.py:36
msgid "HTTPException"
msgstr "Erreur HTTP"
#: pacman_mirrors/txt.py:41
#: pacman_mirrors/txt.py:38
msgid "PATH"
msgstr "CHEMIN"
#: pacman_mirrors/txt.py:42
#: pacman_mirrors/txt.py:39
msgid "FILE"
msgstr "FICHIER"
#: pacman_mirrors/txt.py:43
#: pacman_mirrors/txt.py:40
msgid "SECONDS"
msgstr "SECONDES"
#: pacman_mirrors/txt.py:45
#: pacman_mirrors/txt.py:41
msgid "DIGIT"
msgstr "CHIFFRE"
#: pacman_mirrors/txt.py:43
msgid "Branch name"
msgstr "Branche"
#: pacman_mirrors/txt.py:46
#: pacman_mirrors/txt.py:44
msgid "Comma separated list of countries, from which mirrors will be used"
msgstr "Liste des pays, séparée par une virgule, à partir desquels les miroirs vont être utilisés."
#: pacman_mirrors/txt.py:48
#: pacman_mirrors/txt.py:46
msgid "Output file"
msgstr "Fichier de sortie"
#: pacman_mirrors/txt.py:49
#: pacman_mirrors/txt.py:47
msgid "Generate mirrorlist"
msgstr "Générer la liste de miroirs"
#: pacman_mirrors/txt.py:50
#: pacman_mirrors/txt.py:48
msgid "Get current country using geolocation. Ignored if"
msgstr "Obtenir le pays courant en utilisation la géolocalisation"
#: pacman_mirrors/txt.py:51
#: pacman_mirrors/txt.py:49
msgid "is supplied"
msgstr "est donné"
#: pacman_mirrors/txt.py:52
#: pacman_mirrors/txt.py:50
msgid "Generate custom mirrorlist"
msgstr "Génération de la liste de miroirs personalisée"
#: pacman_mirrors/txt.py:53
#: pacman_mirrors/txt.py:51
msgid "Generation method"
msgstr "Méthode de génération"
#: pacman_mirrors/txt.py:54
#: pacman_mirrors/txt.py:52
msgid "Don't generate mirrorlist if"
msgstr "Ne pas générer la liste de miroirs si"
#: pacman_mirrors/txt.py:55
#: pacman_mirrors/txt.py:53
msgid "in the configuration file"
msgstr "dans le fichier de configuration"
#: pacman_mirrors/txt.py:56
#: pacman_mirrors/txt.py:54
msgid "Mirrors list path"
msgstr "Chemin de la liste de miroirs"
#: pacman_mirrors/txt.py:57
#: pacman_mirrors/txt.py:55
msgid "Quiet mode - less verbose output"
msgstr "Mode silencieux - moins de sortie"
#: pacman_mirrors/txt.py:58
#: pacman_mirrors/txt.py:56
msgid "Maximum waiting time for server response"
msgstr "Temps maximum d'attente de la réponse du serveur"
#: pacman_mirrors/txt.py:59
#: pacman_mirrors/txt.py:57
msgid "Print the pacman-mirrors version"
msgstr "Afficher la version de pacman-mirrors"
#: pacman_mirrors/txt.py:58
msgid "A quick mirrorlist. Overrides -cim --geoip"
msgstr "Une liste de miroir rapide. Annule - cim --geoip"
#: pacman_mirrors/txt.py:60
msgid "Available countries are"
msgstr "Les pays disponibles sont"
#: pacman_mirrors/txt.py:61
msgid "Cannot read file"
msgstr "Impossible de lire le fichier"
msgid "Could not download from"
msgstr "Impossible de télécharger depuis"
#: pacman_mirrors/txt.py:62
msgid "Cannot update file"
msgstr "Impossible de mettre à jour le fichier"
msgid "Cannot read file"
msgstr "Impossible de lire le fichier"
#: pacman_mirrors/txt.py:63
msgid "Cannot write file"
msgstr "Impossible d'écrire le fichier"
#: pacman_mirrors/txt.py:64
msgid "Must have root privileges"
msgstr "Requiert les droits super-utilisateur."
msgid "Converting custom mirror file to new format"
msgstr "Conversion de la liste de miroir personnalisée dans le nouveau format"
#: pacman_mirrors/txt.py:65
msgid "Cannot read server response"
msgstr "Impossible de lire la réponse du serveur"
msgid "Custom mirror file"
msgstr "Liste de miroir personnalisée"
#: pacman_mirrors/txt.py:66
msgid "server not available"
msgstr "serveur indisponible"
msgid "Custom mirror file saved"
msgstr "Liste de miroir personnalisée sauvegardée"
#: pacman_mirrors/txt.py:67
msgid "Failed to reach server"
msgstr "Impossible de joindre le serveur"
msgid "User generated mirror list"
msgstr "Liste de miroirs générée par l'utilisateur"
#: pacman_mirrors/txt.py:68
msgid "The server did not complete the request"
msgstr "Le serveur n'a pas complété la requête"
msgid "doesn't exist."
msgstr "n'existe pas."
#: pacman_mirrors/txt.py:69
msgid "Downloading mirrors from repo.manjaro.org"
msgstr "Téléchargement des miroirs depuis repo.manjaro.org"
#: pacman_mirrors/txt.py:70
msgid "Available countries are"
msgstr "Les pays disponibles sont"
msgid "Falling back to"
msgstr "Revenir à"
#: pacman_mirrors/txt.py:71
msgid "Custom mirrors file"
msgstr "Fichier de miroirs personnalisé"
msgid "is missing"
msgstr "est manquant"
#: pacman_mirrors/txt.py:72
msgid "doesn't exist."
msgstr "n'existe pas."
msgid "The mirror file"
msgstr "Le fichier miroir"
#: pacman_mirrors/txt.py:73
msgid "User generated mirror list"
msgstr "Liste de miroirs générée par l'utilisateur"
msgid "Mirrorlist generated and saved to"
msgstr "Liste de miroirs générée et sauvegardé dans"
#: pacman_mirrors/txt.py:74
msgid "Saved personalized list of mirrors in"
msgstr "Sauvegarde de la liste de miroirs personnalisée dans"
msgid "Must have root privileges"
msgstr "Requiert les droits super-utilisateur."
#: pacman_mirrors/txt.py:75
msgid "is missing"
msgstr "est manquant"
msgid "The mirror list is not changed"
msgstr "La liste de miroirs n'est pas modifiée"
#: pacman_mirrors/txt.py:76
msgid "Use `pacman-mirrors -c all` to reset list"
msgstr "Utiliser `pacman-mirrors -c all` pour réinitialiser la liste"
msgid "No mirrors in selection"
msgstr "Pas de miroirs dans la sélection"
#: pacman_mirrors/txt.py:77
msgid "Mirrorlist generated and saved to"
msgstr "Liste de miroirs générée et sauvegardé dans"
msgid "Option"
msgstr "Option"
#: pacman_mirrors/txt.py:78
msgid "Writing mirror list"
msgstr "Écriture de la liste de miroirs"
#: pacman_mirrors/txt.py:79
msgid "No mirrors in selection"
msgstr "Pas de miroirs dans la sélection"
msgid "Querying mirrors"
msgstr "Interrogation des miroirs"
#: pacman_mirrors/txt.py:80
msgid "The mirror list is not changed"
msgstr "La liste de miroirs n'est pas modifiée"
msgid "Randomizing mirror list"
msgstr "Randomisation de la liste des miroirs"
#: pacman_mirrors/txt.py:81
msgid "Option"
msgstr "Option"
msgid "To reset custom config run `pacman-mirrors -c all`"
msgstr "Pour réinitialiser la configuration personnalisée, lancez `pacman-mirrors -c all`"
#: pacman_mirrors/txt.py:82
msgid "Writing custom mirror file"
msgstr "Écriture de la liste de miroirs personnalisée"
msgid "This may take some time"
msgstr "Cela peut prendre un certain temps"
#: pacman_mirrors/txt.py:83
msgid "Querying all servers"
msgstr "Interrogation de tous les miroirs"
msgid "unknown country"
msgstr "Pays inconnu"
#: pacman_mirrors/txt.py:84
msgid "Querying servers, this may take some time"
msgstr "Test des serveurs, cela peut prendre du temps"
msgid "Using all mirrors"
msgstr "Utilisation de tous les miroirs"
#: pacman_mirrors/txt.py:85
msgid "Using custom mirror list"
msgstr "Utilisation de la liste de miroirs personalisée"
msgid "Using custom mirror file"
msgstr "Utilisation de la liste de miroir personnalisée"
#: pacman_mirrors/txt.py:86
msgid "Testing mirrors in"
msgstr "Tester les miroirs en"
#: pacman_mirrors/txt.py:87
msgid "Wrong date format in state file"
msgstr "Mauvais format de date dans le fichier état"
msgid "Using default mirror file"
msgstr "Utilisation de liste de miroir par défaut"
#: pacman_mirrors/txt.py:88
msgid "Randomizing server list"
msgstr "Liste des serveurs triée au hasard"
msgid "Manjaro mirrors by response time"
msgstr "Miroirs de Manjaro triés par temps de réponse"
#: pacman_mirrors/txt.py:89
msgid "unknown country"
msgstr "Pays inconnu"
msgid "Manjaro mirrors in random order"
msgstr "Miroirs de Manjaro au hasard"
#: pacman_mirrors/txt.py:90
msgid "Using all servers"
msgstr "Utilisation de tous les miroirs"
#: pacman_mirrors/txt.py:92
msgid "Manjaro mirrors by response time"
msgstr "Miroirs de Manjaro triés par temps de réponse"
#: pacman_mirrors/txt.py:93
msgid "Check mirrors for your personal list"
msgstr "Vérifier les miroirs pour votre liste personnelle"
#: pacman_mirrors/txt.py:94
#: pacman_mirrors/txt.py:91
msgid "Use"
msgstr "Utiliser"
#: pacman_mirrors/txt.py:95
#: pacman_mirrors/txt.py:92
msgid "Country"
msgstr "Pays"
#: pacman_mirrors/txt.py:96
#: pacman_mirrors/txt.py:93
msgid "Resp"
msgstr "Rép"
#: pacman_mirrors/txt.py:97
#: pacman_mirrors/txt.py:94
msgid "Sync"
msgstr "Synchronisation"
#: pacman_mirrors/txt.py:98
#: pacman_mirrors/txt.py:95
msgid "URL"
msgstr "URL"
#: pacman_mirrors/txt.py:99
#: pacman_mirrors/txt.py:96
msgid "Cancel"
msgstr "Annuler"
#: pacman_mirrors/txt.py:100
#: pacman_mirrors/txt.py:97
msgid "OK"
msgstr "OK"
#: pacman_mirrors/txt.py:101
#: pacman_mirrors/txt.py:98
msgid "Confirm selections"
msgstr "Confirmer la sélection"
#: pacman_mirrors/txt.py:102
#: pacman_mirrors/txt.py:99
msgid "I want to use these mirrors"
msgstr "Je veux utiliser ces miroirs"
......@@ -18,6 +18,7 @@
# Authors: Frede Hundewadt <frede@hundewadt.dk>
"""Pacman-Mirrors Configuration Functions"""
import os
import tempfile
......@@ -27,9 +28,7 @@ from . import configuration as conf
def build_config():
"""Get config informations"""
# initialising defaults
# information which can differ from these defaults
# is fetched from config file
# default config
config = {
"branch": "stable",
"branches": conf.BRANCHES,
......@@ -47,8 +46,8 @@ def build_config():
"url_mirrors_json": conf.URL_MIRROR_JSON,
"url_status_json": conf.URL_STATUS_JSON
}
# try to replace default entries by reading conf file
try:
# read configuration from file
with open(config["config_file"]) as conf_file:
for line in conf_file:
line = line.strip()
......
......@@ -18,6 +18,7 @@
# Authors: Frede Hundewadt <frede@hundewadt.dk>
"""Pacman-Mirrors Console Functions"""
import json
......
......@@ -49,11 +49,7 @@ def convert_to_json():
})
# write new file
jsonfn.write_json_file(mirrors, conf.CUSTOM_FILE)
cleanup()
def cleanup():
os.remove(conf.O_CUST_FILE)
os.remove(conf.O_CUST_FILE)
def get_protocol(data):
......
......@@ -36,7 +36,7 @@ def read_json_file(filename, dictionary=True):
result = json.load(infile)
except OSError:
return result
pass
return result
......
......@@ -56,7 +56,7 @@ def get_geoip_country(countrylist):
:return: country name if found
"""
g_country = httpfn.get_geoip_country()
if validfn.country_is_in_countrylist(g_country, countrylist):
if g_country in countrylist:
return g_country
else:
return None
......@@ -68,7 +68,6 @@ def filter_mirror_list(mirrorlist, countrylist):
:param countrylist:
:rtype: list
"""
result = []
for mirror in mirrorlist:
if mirror["country"] in countrylist:
......
......@@ -55,7 +55,7 @@ HLP_ARG_PATH = _("Mirrors list path")
HLP_ARG_QUIET = _("Quiet mode - less verbose output")
HLP_ARG_TIMEOUT = _("Maximum waiting time for server response")
HLP_ARG_VERSION = _("Print the pacman-mirrors version")
HLP_ARG_FASTTRACK = _("A quick mirrorlist. Overrides -cim --geoip")
HLP_ARG_FASTTRACK = _("A quick mirrorlist. Overrides") + "-cim --geoip"
# messages
AVAILABLE_COUNTRIES = _("Available countries are")
CANNOT_DOWNLOAD_FILE = _("Could not download from")
......@@ -66,7 +66,7 @@ CUSTOM_MIRROR_FILE = _("Custom mirror file")
CUSTOM_MIRROR_FILE_SAVED = _("Custom mirror file saved")
CUSTOM_MIRROR_LIST = _("User generated mirror list")
DOES_NOT_EXIST = _("doesn't exist.")
DOWNLOADING_MIRROR_FILE = _("Downloading mirrors from repo.manjaro.org")
DOWNLOADING_MIRROR_FILE = _("Downloading mirrors from") + "repo.manjaro.org"
FALLING_BACK = _("Falling back to")
IS_MISSING = _("is missing")
MIRROR_FILE = _("The mirror file")
......@@ -83,7 +83,7 @@ OPTION = _("Option")
WRITING_MIRROR_LIST = _("Writing mirror list")
QUERY_MIRRORS = _("Querying mirrors")
RANDOMIZING_SERVERS = _("Randomizing mirror list")
RESET_CUSTOM_CONFIG = _("To reset custom config run `pacman-mirrors -c all`")
RESET_CUSTOM_CONFIG = _("To reset custom config run ") + "pacman-mirrors -c all"
TAKES_TIME = _("This may take some time")
UNKNOWN_COUNTRY = _("unknown country")
USING_ALL_MIRRORS = _("Using all mirrors")
......
......@@ -25,21 +25,13 @@ from . import configuration as conf
from . import txt
def country_is_in_countrylist(country, countrylist):
"""Check if country is in list"""
if country in countrylist:
return True # good
return False
def custom_config_is_valid():
"""Check validity of custom selection
:return: True or False
:rtype: bool
"""
if os.path.isfile(conf.CUSTOM_FILE):
return True # valid
else:
valid = os.path.isfile(conf.CUSTOM_FILE)
if not valid:
# validation fail - inform user and exit
print(".: {} {} {} {}".format(txt.ERR_CLR,
txt.CUSTOM_MIRROR_FILE,
......@@ -48,7 +40,7 @@ def custom_config_is_valid():
print(".: {} {}: {}".format(txt.INF_CLR,
txt.FALLING_BACK,
txt.USING_ALL_MIRRORS))
return False
return valid
def country_list_is_valid(onlycountry, countrylist):
......@@ -59,9 +51,7 @@ def country_list_is_valid(onlycountry, countrylist):
:rtype: bool
"""
for country in onlycountry:
if country_is_in_countrylist(country, countrylist):
continue # good
else: # validation fail - inform user and exit
if not country in countrylist:
print(".: {} {}{}: {}: '{}'".format(txt.WRN_CLR,
txt.OPTION,
txt.OPT_COUNTRY,
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of pacman-mirrors.
#
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import io
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment