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
2625import polib
2726import os
2827import sys
29- import stat
3028
3129VERSION = "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
110108cmdclass = {
111109 "build" : build ,
112110 "build_trans" : build_trans ,
113- "install_data " : install_data ,
111+ "install " : install ,
114112}
115113
116114data_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