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

@@ -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']))