Skip to content

Commit 7c78e61

Browse files
committed
Use setuptools instead of distutils
1 parent 882310d commit 7c78e61

File tree

3 files changed

+22
-32
lines changed

3 files changed

+22
-32
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ https://aur.archlinux.org/packages/xfce4-dockbarx-plugin/
4545
## Manual Installation
4646

4747
1. Following dependencies needs to be installed (many of them might be installed already on your system):
48-
- gir1.2-gtk-3.0 (>= 3.22), gir1.2-glib-2.0 (>= 1.40), gir1.2-keybinder-3.0, gir1.2-pango-1.0, gir1.2-wnck-3.0, python3 (>= 3.5), python3-cairo (>= 1.11.0), python3-dbus, python3-distutils, python3-gi, python3-gi-cairo, python3-pil, python3-polib, python3-xdg and python3-xlib.
48+
- gir1.2-gtk-3.0 (>= 3.22), gir1.2-glib-2.0 (>= 1.40), gir1.2-keybinder-3.0, gir1.2-pango-1.0, gir1.2-wnck-3.0, python3 (>= 3.5), python3-cairo (>= 1.11.0), python3-dbus, python3-gi, python3-gi-cairo, python3-pil, python3-xdg and python3-xlib.
49+
- (Only for build) python3-pip, python3-polib, python3-setuptools
4950
- (Optional) gir1.2-zeitgeist-2.0 and zeitgeist, to access latest and most used documents.
5051
- (Optional) indicator-application or ayatana-indicator-application, to use the appindicator applet with DockX
5152
- (Optional) python3-pyudev (>= 0.15), to use the battery status applet with DockX
5253
- (Optional) python3-lxml, to use the settings migrating tool
53-
2. Extract dockbarx. Change directory to where you extracted dockbarx and run the setup.py install `$ sudo ./setup.py install`
54+
2. Extract dockbarx. Change directory to where you extracted dockbarx and run the following commands:
55+
```
56+
sudo pip install --prefix=/usr .
57+
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
58+
```
5459

5560
## Usage
5661
To run DockbarX as a stand alone dock use the command `dockx`.

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools", "polib"]
3+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,18 @@
1717
# You should have received a copy of the GNU General Public License
1818
# along with dockbar. If not, see <http://www.gnu.org/licenses/>.
1919

20-
from distutils.core import setup
21-
from distutils.core import setup
22-
from distutils import cmd
23-
from distutils.command.install_data import install_data as _install_data
24-
from distutils.command.build import build as _build
20+
from setuptools import setup
21+
from setuptools import Command
22+
from setuptools.command.install import install as _install
23+
from setuptools.command.build import build as _build
2524

2625
import polib
2726
import os
2827
import sys
29-
import stat
3028

3129
VERSION = "1.0-beta3"
3230

33-
class build_trans(cmd.Command):
31+
class build_trans(Command):
3432
description = "Compile .po files into .mo files"
3533
def initialize_options(self):
3634
pass
@@ -70,7 +68,7 @@ class build(_build):
7068
def run(self):
7169
_build.run(self)
7270

73-
class install_data(_install_data):
71+
class install(_install):
7472

7573
def run(self):
7674
for lang in os.listdir("build/locale/"):
@@ -85,14 +83,14 @@ def run(self):
8583
lang_files.append(d_file)
8684
if os.path.exists(dt_file):
8785
lang_files.append(dt_file)
88-
self.data_files.append( (lang_dir, lang_files) )
86+
self.distribution.data_files.append( (lang_dir, lang_files) )
8987
# Scan folders for the right files
90-
self.scan_path("/usr/share/dockbarx/themes", "themes", ext=".tar.gz")
88+
self.scan_path("share/dockbarx/themes", "themes", ext=".tar.gz")
9189
self.scan_path("share/icons/", "icons", ext=".png")
9290
self.scan_path("share/dockbarx/applets/namebar_themes",
9391
"dockx_applets/namebar_themes",
9492
ext=".tar.gz")
95-
_install_data.run(self)
93+
_install.run(self)
9694

9795
def scan_path(self, install_path, base_path, path="", ext=""):
9896
files = []
@@ -104,13 +102,13 @@ def scan_path(self, install_path, base_path, path="", ext=""):
104102
elif os.path.isfile(fpath) and fpath.endswith(ext):
105103
files.append(fpath)
106104
if files:
107-
self.data_files.append((os.path.join(install_path, path), files))
105+
self.distribution.data_files.append((os.path.join(install_path, path), files))
108106

109107

110108
cmdclass = {
111109
"build": build,
112110
"build_trans": build_trans,
113-
"install_data": install_data,
111+
"install": install,
114112
}
115113

116114
data_files=[
@@ -142,7 +140,7 @@ def scan_path(self, install_path, base_path, path="", ext=""):
142140
("share/mate-panel/ui/", ["mate_panel_applet/dockbarx-applet-menu.xml"]),
143141
]
144142

145-
s = setup(name="Dockbarx",
143+
setup(name="Dockbarx",
146144
version=VERSION,
147145
description="A dock-ish gnome-applet",
148146
author="Aleksey Shaferov and Matias Sars",
@@ -153,19 +151,3 @@ def scan_path(self, install_path, base_path, path="", ext=""):
153151
)
154152

155153

156-
157-
if len(sys.argv) == 2 and sys.argv[1] == "install":
158-
install_data_path = s.command_obj['install'].install_data
159-
schema_path = os.path.join(install_data_path, "share/glib-2.0/schemas")
160-
os.system("glib-compile-schemas %s" % schema_path)
161-
# create sudo policy file for battery_status_helper.sh
162-
helper_file = os.path.join(install_data_path, 'share/dockbarx/applets/battery_status_helper.sh')
163-
sudo_policy_file = '/etc/sudoers.d/dockbarx-applet-battery-status-helper'
164-
try:
165-
f = open(sudo_policy_file, 'w')
166-
f.write('ALL ALL=(root) NOPASSWD:%s\n' % helper_file)
167-
f.close()
168-
os.chmod(sudo_policy_file, stat.S_IRUSR | stat.S_IRGRP)
169-
except:
170-
pass
171-

0 commit comments

Comments
 (0)