17
17
# You should have received a copy of the GNU General Public License
18
18
# along with dockbar. If not, see <http://www.gnu.org/licenses/>.
19
19
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
25
24
26
25
import polib
27
26
import os
28
27
import sys
29
- import stat
30
28
31
29
VERSION = "1.0-beta3"
32
30
33
- class build_trans (cmd . Command ):
31
+ class build_trans (Command ):
34
32
description = "Compile .po files into .mo files"
35
33
def initialize_options (self ):
36
34
pass
@@ -70,7 +68,7 @@ class build(_build):
70
68
def run (self ):
71
69
_build .run (self )
72
70
73
- class install_data ( _install_data ):
71
+ class install ( _install ):
74
72
75
73
def run (self ):
76
74
for lang in os .listdir ("build/locale/" ):
@@ -85,14 +83,14 @@ def run(self):
85
83
lang_files .append (d_file )
86
84
if os .path .exists (dt_file ):
87
85
lang_files .append (dt_file )
88
- self .data_files .append ( (lang_dir , lang_files ) )
86
+ self .distribution . data_files .append ( (lang_dir , lang_files ) )
89
87
# 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" )
91
89
self .scan_path ("share/icons/" , "icons" , ext = ".png" )
92
90
self .scan_path ("share/dockbarx/applets/namebar_themes" ,
93
91
"dockx_applets/namebar_themes" ,
94
92
ext = ".tar.gz" )
95
- _install_data .run (self )
93
+ _install .run (self )
96
94
97
95
def scan_path (self , install_path , base_path , path = "" , ext = "" ):
98
96
files = []
@@ -104,13 +102,13 @@ def scan_path(self, install_path, base_path, path="", ext=""):
104
102
elif os .path .isfile (fpath ) and fpath .endswith (ext ):
105
103
files .append (fpath )
106
104
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 ))
108
106
109
107
110
108
cmdclass = {
111
109
"build" : build ,
112
110
"build_trans" : build_trans ,
113
- "install_data " : install_data ,
111
+ "install " : install ,
114
112
}
115
113
116
114
data_files = [
@@ -142,7 +140,7 @@ def scan_path(self, install_path, base_path, path="", ext=""):
142
140
("share/mate-panel/ui/" , ["mate_panel_applet/dockbarx-applet-menu.xml" ]),
143
141
]
144
142
145
- s = setup (name = "Dockbarx" ,
143
+ setup (name = "Dockbarx" ,
146
144
version = VERSION ,
147
145
description = "A dock-ish gnome-applet" ,
148
146
author = "Aleksey Shaferov and Matias Sars" ,
@@ -153,19 +151,3 @@ def scan_path(self, install_path, base_path, path="", ext=""):
153
151
)
154
152
155
153
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