Use touch for empty file

This commit is contained in:
gryf committed 2020-08-31 21:36:34 +02:00
1 parent c684b4de9e
commit e6afb9232d
2 files changed
+12 -17

No files matched your search

-9
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.
+12 -8
View File
@@ -23,6 +23,7 @@ import os
import json
import re
import configparser
import pathlib
import shutil
import subprocess
from distutils import log
@@ -64,7 +65,10 @@ data = []
# path to the file to put in empty directories
# 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
os.chdir(os.path.abspath(os.path.split(__file__)[0]))
@@ -352,13 +356,13 @@ class install(_install.install):
with open('wpath.json') as fobj:
wpath = config.Config(json.load(fobj))
data.extend([(wpath.log, [empty_file]),
(wpath.networks, [empty_file]),
(wpath.scripts, [empty_file]),
(wpath.predisconnectscripts, [empty_file]),
(wpath.postdisconnectscripts, [empty_file]),
(wpath.preconnectscripts, [empty_file]),
(wpath.postconnectscripts, [empty_file])])
data.extend([(wpath.log, [keep_file]),
(wpath.networks, [keep_file]),
(wpath.scripts, [keep_file]),
(wpath.predisconnectscripts, [keep_file]),
(wpath.postdisconnectscripts, [keep_file]),
(wpath.preconnectscripts, [keep_file]),
(wpath.postconnectscripts, [keep_file])])
if os.path.exists('data/etc/wicd.conf'):
data.append((wpath.etc, ['data/etc/wicd.conf']))