Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
less insane py2exe command replacement + distutils uses small caps cl…
Browse files Browse the repository at this point in the history
…ass names for it's commands for usage in it's interface (ie setup.py --help-commands)
  • Loading branch information
dieterv committed Dec 29, 2010
1 parent 6ef5e81 commit b94f12d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 23 deletions.
3 changes: 0 additions & 3 deletions lib/pygtk2exe/__init__.py
Expand Up @@ -22,15 +22,12 @@
if not py2exe_version == '0.6.9':
raise ImportError('pygtk2exe requires py2exe 0.6.9 but found %s' % py2exe_version)

# Replace the py2exe command.
from pygtk2exe.command import build_exe
# Replace distutils' Distribution class
from pygtk2exe import dist

# Keep our "namespace" clean
del warnings
del py2exe_version
del build_exe
del dist

# Make everything usable in setup.py scripts available
Expand Down
11 changes: 3 additions & 8 deletions lib/pygtk2exe/command/build_exe.py
Expand Up @@ -5,13 +5,13 @@

from copy import copy

from distutils.util import get_platform

from py2exe.build_exe import py2exe as _py2exe
from py2exe.py2exe_util import depends


class PyGtk2Exe(_py2exe):
class py2exe(_py2exe):
description = 'create a self-contained executable package for MS Windows'

def __init__(self, dist):
_py2exe.__init__(self, dist)

Expand Down Expand Up @@ -167,8 +167,3 @@ def copy_dlls(self, dlls):
os.makedirs(dstdir)

self.copy_file(src, dst, preserve_mode=False, preserve_times=True)


# Replace py2exe.build_exe.py2exe with our own PyGtk2Exe class
import py2exe
py2exe.build_exe.py2exe = PyGtk2Exe
6 changes: 3 additions & 3 deletions lib/pygtk2exe/command/build_ext.py
Expand Up @@ -3,12 +3,12 @@

import os

from dsextras import BuildExt as _BuildExt
from dsextras import BuildExt as _build_ext


class BuildExt(_BuildExt):
class build_ext(_build_ext):
def run(self):
_BuildExt.run(self)
_build_ext.run(self)

# This makes sure py2exe can locate the extension we've built
build_lib = os.path.abspath(self.build_lib)
Expand Down
10 changes: 5 additions & 5 deletions lib/pygtk2exe/command/clean.py
Expand Up @@ -5,24 +5,24 @@

from distutils import log
from distutils.dir_util import remove_tree
from distutils.command.clean import clean as _Clean
from distutils.command.clean import clean as _clean


class Clean(_Clean):
class clean(_clean):
def initialize_options(self):
_Clean.initialize_options(self)
_clean.initialize_options(self)

self.dist_dir = None
self.plat_name = None

def finalize_options(self):
_Clean.finalize_options(self)
_clean.finalize_options(self)

self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'),
('plat_name', 'plat_name'))

def run(self):
_Clean.run(self)
_clean.run(self)

if self.all:
exe_dist_dir = "%s.%s" % (self.distribution.get_fullname(), self.plat_name)
Expand Down
10 changes: 6 additions & 4 deletions lib/pygtk2exe/dist.py
Expand Up @@ -3,8 +3,9 @@

from distutils.dist import Distribution as _Distribution

from pygtk2exe.command.clean import Clean
from pygtk2exe.command.build_ext import BuildExt
from pygtk2exe.command.clean import clean
from pygtk2exe.command.build_ext import build_ext
from pygtk2exe.command.build_exe import py2exe
from pygtk2exe.targets import Extension, CtypesComServer, ComServer, Service, Windows, Console, IsapiFilter


Expand All @@ -24,8 +25,9 @@ def __init__(self, attrs):
_Distribution.__init__(self, attrs)

# Replace distutils commands
self.cmdclass['build_ext'] = BuildExt
self.cmdclass['clean'] = Clean
self.cmdclass['clean'] = clean
self.cmdclass['build_ext'] = build_ext
self.cmdclass['py2exe'] = py2exe

# Run "clean" and "py2exe" commands by default
if not self.script_args:
Expand Down

0 comments on commit b94f12d

Please sign in to comment.