]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wxaddons/setup.py
   1 import distutils
.command
.install_lib
 
   2 import distutils
.command
.install_data
 
   3 import distutils
.command
.install
 
   5 from distutils
.core 
import setup
 
   6 from user 
import home 
# this gives us the user's home dir on all platforms 
   8 class wxaddon_install_lib(distutils
.command
.install_lib
.install_lib
): 
   9     """need to change self.install_dir to the actual library dir""" 
  11         install_cmd 
= self
.get_finalized_command('install') 
  12         self
.install_dir 
= os
.path
.join(getattr(install_cmd
, 'install_purelib'), "wxaddons") 
  13         return distutils
.command
.install_lib
.install_lib
.run(self
) 
  15 class wxaddon_install_data(distutils
.command
.install_data
.install_data
): 
  17         self
.install_dir 
= os
.path
.join(home
, ".wxaddons_data", self
.distribution
.get_name()) 
  18         if not os
.path
.exists(self
.install_dir
): 
  19             os
.makedirs(self
.install_dir
) 
  20         return distutils
.command
.install_data
.install_data
.run(self
) 
  22 class wxaddon_install(distutils
.command
.install
.install
): 
  24         result 
= distutils
.command
.install
.install
.run(self
) 
  27         config 
= wx
.Config("wxaddons-receipts") 
  28         config
.SetPath(self
.distribution
.get_name()) 
  29         config
.Write("Version", str(self
.distribution
.get_version())) 
  30         config
.Write("Summary", self
.distribution
.get_description()) 
  31         config
.Write("Home-page", self
.distribution
.get_url()) 
  33         # NB: Although self.distribution has get_author() and get_author_email() 
  34         # methods, get_contact* returns either author or maintainer, and I think 
  35         # either is suitable for our purposes. 
  36         config
.Write("Author", self
.distribution
.get_contact()) 
  37         config
.Write("Author-email", self
.distribution
.get_contact_email()) 
  38         config
.Write("License", self
.distribution
.get_license()) 
  40         keywords 
= string
.join( self
.distribution
.get_keywords(), ';') 
  42             config
.Write('Keywords', keywords
) 
  44         platforms 
= string
.join( self
.distribution
.get_platforms(), ';') 
  46             config
.Write('Platforms', platforms 
) 
  48         classifiers 
= string
.join( self
.distribution
.get_classifiers(), ';') 
  50             config
.Write('Classifiers', classifiers 
) 
  54 def wxaddon(**kwargs
): 
  55     kwargs
['cmdclass'] =  {'install_lib' :    wxaddon_install_lib
,  
  56                            'install' :  wxaddon_install
, 
  57                            'install_data' : wxaddon_install_data 
}