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

Use touch for empty file

This commit is contained in:
2020-08-31 21:36:34 +02:00
parent c684b4de9e
commit e6afb9232d
2 changed files with 12 additions and 17 deletions

View File

@@ -1,9 +0,0 @@
If you're reading this file, that means that you found a directory that
is empty by default when Wicd is installed. Congratulations!
At this point, the directory probably isn't empty, so perhaps the name
of this file is a little confusing.
Some package managers and some version control systems don't allow for
installation or storage of empty directories, so this file exists to
make them work properly. Just ignore it and continue on with your life.

View File

@@ -23,6 +23,7 @@ import os
import json import json
import re import re
import configparser import configparser
import pathlib
import shutil import shutil
import subprocess import subprocess
from distutils import log from distutils import log
@@ -64,7 +65,10 @@ data = []
# path to the file to put in empty directories # path to the file to put in empty directories
# fixes https://bugs.launchpad.net/wicd/+bug/503028 # fixes https://bugs.launchpad.net/wicd/+bug/503028
empty_file = 'other/.empty_on_purpose' keep_file = '.keep'
if not os.path.exists(keep_file):
pathlib.Path(keep_file).touch()
# change to the directory setup.py is contained in # change to the directory setup.py is contained in
os.chdir(os.path.abspath(os.path.split(__file__)[0])) os.chdir(os.path.abspath(os.path.split(__file__)[0]))
@@ -352,13 +356,13 @@ class install(_install.install):
with open('wpath.json') as fobj: with open('wpath.json') as fobj:
wpath = config.Config(json.load(fobj)) wpath = config.Config(json.load(fobj))
data.extend([(wpath.log, [empty_file]), data.extend([(wpath.log, [keep_file]),
(wpath.networks, [empty_file]), (wpath.networks, [keep_file]),
(wpath.scripts, [empty_file]), (wpath.scripts, [keep_file]),
(wpath.predisconnectscripts, [empty_file]), (wpath.predisconnectscripts, [keep_file]),
(wpath.postdisconnectscripts, [empty_file]), (wpath.postdisconnectscripts, [keep_file]),
(wpath.preconnectscripts, [empty_file]), (wpath.preconnectscripts, [keep_file]),
(wpath.postconnectscripts, [empty_file])]) (wpath.postconnectscripts, [keep_file])])
if os.path.exists('data/etc/wicd.conf'): if os.path.exists('data/etc/wicd.conf'):
data.append((wpath.etc, ['data/etc/wicd.conf'])) data.append((wpath.etc, ['data/etc/wicd.conf']))