Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
setup.build_scripts_moin Class Reference
Inheritance diagram for setup.build_scripts_moin:
Inheritance graph
[legend]
Collaboration diagram for setup.build_scripts_moin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def copy_scripts

Static Public Attributes

string package_name = 'MoinMoin'

Detailed Description

Definition at line 184 of file setup.py.


Member Function Documentation

def setup.build_scripts_create.copy_scripts (   self) [inherited]
Create each script listed in 'self.scripts'

Definition at line 134 of file setup.py.

00134 
00135     def copy_scripts(self):
00136         """ Create each script listed in 'self.scripts'
00137         """
00138         if not self.package_name:
00139             raise Exception("You have to inherit build_scripts_create and"
00140                 " provide a package name")
00141 
00142         self.mkpath(self.build_dir)
00143         for script in self.scripts:
00144             outfile = os.path.join(self.build_dir, os.path.basename(script))
00145 
00146             #if not self.force and not newer(script, outfile):
00147             #    self.announce("not copying %s (up-to-date)" % script)
00148             #    continue
00149 
00150             if self.dry_run:
00151                 self.announce("would create %s" % outfile)
00152                 continue
00153 
00154             module = os.path.splitext(os.path.basename(script))[0]
00155             module = module.replace('-', '_').replace('/', '.')
00156             script_vars = {
00157                 'python': os.path.normpath(sys.executable),
00158                 'package': self.package_name,
00159                 'module': module,
00160                 'package_location': '/usr/lib/python/site-packages', # FIXME: we need to know the correct path
00161             }
00162 
00163             self.announce("creating %s" % outfile)
00164             file = open(outfile, 'w')
00165 
00166             try:
00167                 if sys.platform == "win32":
00168                     file.write('@echo off\n'
00169                         'if NOT "%%_4ver%%" == "" %(python)s -c "from %(package)s.script.%(module)s import run; run()" %%$\n'
00170                         'if     "%%_4ver%%" == "" %(python)s -c "from %(package)s.script.%(module)s import run; run()" %%*\n'
00171                         % script_vars)
00172                 else:
00173                     file.write("#! %(python)s\n"
00174                         "#Fix and uncomment those 2 lines if your moin command doesn't find the MoinMoin package:\n"
00175                         "#import sys\n"
00176                         "#sys.path.insert(0, '%(package_location)s')\n"
00177                         "from %(package)s.script.%(module)s import run\n"
00178                         "run()\n"
00179                         % script_vars)
00180             finally:
00181                 file.close()
00182                 os.chmod(outfile, 0755)
00183 


Member Data Documentation

string setup.build_scripts_moin.package_name = 'MoinMoin' [static]

Reimplemented from setup.build_scripts_create.

Definition at line 185 of file setup.py.


The documentation for this class was generated from the following file: