1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 21:08:06 +01:00

Make regexp string, not binary

This commit is contained in:
2020-07-30 16:27:19 +02:00
parent 581a1eed29
commit 47f0687e92

View File

@@ -69,7 +69,7 @@ class build(_build):
class configure(Command): class configure(Command):
description = "configure the paths that Wicd will be installed to" description = "configure the paths that Wicd will be installed to"
user_options = [ user_options = [
# The first bunch is DIRECTORIES - they need to end with a slash ("/"), # The first bunch is DIRECTORIES - they need to end with a slash ("/"),
# which will automatically be tacked on in the finalize_options method # which will automatically be tacked on in the finalize_options method
@@ -106,10 +106,10 @@ class configure(Command):
('docdir=', None, 'set the directory for the documentation'), ('docdir=', None, 'set the directory for the documentation'),
('mandir=', None, 'set the directory for the man pages'), ('mandir=', None, 'set the directory for the man pages'),
('kdedir=', None, 'set the kde autostart directory'), ('kdedir=', None, 'set the kde autostart directory'),
# Anything after this is a FILE; in other words, a slash ("/") will # Anything after this is a FILE; in other words, a slash ("/") will
# not automatically be added to the end of the path. # not automatically be added to the end of the path.
# Do NOT remove the python= entry, as it signals the beginning of # Do NOT remove the python= entry, as it signals the beginning of
# the file section. # the file section.
('python=', None, 'set the path to the Python executable'), ('python=', None, 'set the path to the Python executable'),
('pidfile=', None, 'set the pid file'), ('pidfile=', None, 'set the pid file'),
@@ -135,7 +135,7 @@ class configure(Command):
('no-install-gnome-shell-extensions', None, 'do not install the Gnome Shell extension'), ('no-install-gnome-shell-extensions', None, 'do not install the Gnome Shell extension'),
('no-use-notifications', None, 'do not ever allow the use of libnotify notifications') ('no-use-notifications', None, 'do not ever allow the use of libnotify notifications')
] ]
def initialize_options(self): def initialize_options(self):
self.lib = '/usr/lib/wicd/' self.lib = '/usr/lib/wicd/'
self.share = '/usr/share/wicd/' self.share = '/usr/share/wicd/'
@@ -170,7 +170,7 @@ class configure(Command):
self.mandir = '/usr/share/man/' self.mandir = '/usr/share/man/'
self.kdedir = '/usr/share/autostart/' self.kdedir = '/usr/share/autostart/'
self.distro = 'auto' self.distro = 'auto'
self.no_install_init = False self.no_install_init = False
self.no_install_man = False self.no_install_man = False
self.no_install_i18n = False self.no_install_i18n = False
@@ -187,7 +187,7 @@ class configure(Command):
# Determine the default init file location on several different distros # Determine the default init file location on several different distros
self.distro_detect_failed = False self.distro_detect_failed = False
self.initfile = 'init/default/wicd' self.initfile = 'init/default/wicd'
# ddistro is the detected distro # ddistro is the detected distro
if os.path.exists('/etc/redhat-release'): if os.path.exists('/etc/redhat-release'):
@@ -223,12 +223,12 @@ class configure(Command):
# Try to get the pm-utils sleep hooks directory from pkg-config and # Try to get the pm-utils sleep hooks directory from pkg-config and
# the kde prefix from kde-config # the kde prefix from kde-config
# Don't run these in a shell because it's not needed and because shell # Don't run these in a shell because it's not needed and because shell
# swallows the OSError we would get if {pkg,kde}-config do not exist # swallows the OSError we would get if {pkg,kde}-config do not exist
# If we don't get anything from *-config, or it didn't run properly, # If we don't get anything from *-config, or it didn't run properly,
# or the path is not a proper absolute path, raise an error # or the path is not a proper absolute path, raise an error
try: try:
pmtemp = subprocess.Popen(["pkg-config", "--variable=pm_sleephooks", pmtemp = subprocess.Popen(["pkg-config", "--variable=pm_sleephooks",
"pm-utils"], stdout=subprocess.PIPE) "pm-utils"], stdout=subprocess.PIPE)
returncode = pmtemp.wait() # let it finish, and get the exit code returncode = pmtemp.wait() # let it finish, and get the exit code
pmutils_candidate = str(pmtemp.stdout.readline().strip()) # read stdout pmutils_candidate = str(pmtemp.stdout.readline().strip()) # read stdout
@@ -261,7 +261,7 @@ class configure(Command):
else: else:
self.kdedir = kde4dir_candidate + '/share/autostart' self.kdedir = kde4dir_candidate + '/share/autostart'
except (OSError, ValueError, FileNotFoundError): except (OSError, ValueError, FileNotFoundError):
# If neither kde-config nor kde4-config are not present or # If neither kde-config nor kde4-config are not present or
# return an error, then we can assume that kde isn't installed # return an error, then we can assume that kde isn't installed
# on the user's system # on the user's system
self.no_install_kde = True self.no_install_kde = True
@@ -358,9 +358,9 @@ class configure(Command):
else: else:
cur_arg = argument[0] cur_arg = argument[0]
cur_arg_value = getattr(self, cur_arg.replace('-', '_')) cur_arg_value = getattr(self, cur_arg.replace('-', '_'))
print("Found switch %s %s" % (argument, cur_arg_value)) print("Found switch %s %s" % (argument, cur_arg_value))
values.append((cur_arg, bool(cur_arg_value))) values.append((cur_arg, bool(cur_arg_value)))
print('Replacing values in template files...') print('Replacing values in template files...')
for item in os.listdir('in'): for item in os.listdir('in'):
if item.endswith('.in'): if item.endswith('.in'):
@@ -383,9 +383,9 @@ class configure(Command):
line = line.replace('%VERSION%', str(VERSION_NUM)) line = line.replace('%VERSION%', str(VERSION_NUM))
line = line.replace('%REVNO%', str(REVISION_NUM)) line = line.replace('%REVNO%', str(REVISION_NUM))
line = line.replace('%CURSES_REVNO%', str(CURSES_REVNO)) line = line.replace('%CURSES_REVNO%', str(CURSES_REVNO))
item_out.write(line) item_out.write(line)
item_out.close() item_out.close()
item_in.close() item_in.close()
shutil.copymode(original_name, final_name) shutil.copymode(original_name, final_name)
@@ -398,10 +398,10 @@ class clear_generated(Command):
def initialize_options(self): def initialize_options(self):
pass pass
def finalize_options(self): def finalize_options(self):
pass pass
def run(self): def run(self):
print('Removing completed template files...') print('Removing completed template files...')
for item in os.listdir('in'): for item in os.listdir('in'):
@@ -550,15 +550,15 @@ class install(_install):
class test(Command): class test(Command):
description = "run Wicd's unit tests" description = "run Wicd's unit tests"
user_options = [] user_options = []
def initialize_options(self): def initialize_options(self):
pass pass
def finalize_options(self): def finalize_options(self):
pass pass
def run(self): def run(self):
print("importing tests") print("importing tests")
import tests import tests
@@ -579,7 +579,7 @@ class update_message_catalog(Command):
def run(self): def run(self):
os.system('pybabel extract . -o po/wicd.pot --sort-output') os.system('pybabel extract . -o po/wicd.pot --sort-output')
os.system('xgettext -L glade data/wicd.ui -j -o po/wicd.pot') os.system('xgettext -L glade data/wicd.ui -j -o po/wicd.pot')
class update_translations(Command): class update_translations(Command):
description = "update po-files with new strings from wicd.pot" description = "update po-files with new strings from wicd.pot"
@@ -607,7 +607,7 @@ class compile_translations(Command):
def finalize_options(self): def finalize_options(self):
pass pass
def run(self): def run(self):
try: try:
import wpath import wpath
@@ -636,7 +636,7 @@ class compile_translations(Command):
print(len(output), returncode) print(len(output), returncode)
raise ValueError raise ValueError
else: else:
m = re.match(b'(\d+) translated messages(?:, (\d+) fuzzy translation)?(?:, (\d+) untranslated messages)?.', output) m = re.match('(\d+) translated messages(?:, (\d+) fuzzy translation)?(?:, (\d+) untranslated messages)?.', output)
if m: if m:
done, fuzzy, missing = m.groups() done, fuzzy, missing = m.groups()
fuzzy = int(fuzzy) if fuzzy else 0 fuzzy = int(fuzzy) if fuzzy else 0
@@ -660,7 +660,7 @@ class compile_translations(Command):
class uninstall(Command): class uninstall(Command):
description = "remove Wicd using uninstall.sh and install.log" description = "remove Wicd using uninstall.sh and install.log"
user_options = [] user_options = []
def initialize_options(self): def initialize_options(self):
@@ -694,7 +694,7 @@ setup(
description = "A wireless and wired network manager", description = "A wireless and wired network manager",
long_description = """A complete network connection manager long_description = """A complete network connection manager
Wicd supports wired and wireless networks, and capable of Wicd supports wired and wireless networks, and capable of
creating and tracking profiles for both. It has a creating and tracking profiles for both. It has a
template-based wireless encryption system, which allows the user template-based wireless encryption system, which allows the user
to easily add encryption methods used. It ships with some common to easily add encryption methods used. It ships with some common
encryption types, such as WPA and WEP. Wicd will automatically encryption types, such as WPA and WEP. Wicd will automatically