Skip to content

Commit

Permalink
Be less aggressive about calling that
Browse files Browse the repository at this point in the history
- Only do so if the command was called, and do so on the top level as
  the methods are executed separately, so the atexit registration must
  be done on construction.
  • Loading branch information
metatoaster committed Jun 9, 2017
1 parent e786fd7 commit 535aab8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ include =
exclude =
src/calmjs/parse/parsers/*tab*.py,
.git,
.eggs,
.env*,
env*
31 changes: 26 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
import atexit
import sys
from setuptools import setup, find_packages
from setuptools.command.develop import develop
from setuptools.command.install import install
from subprocess import call


class DevelopHook(develop):
"""For hooking the optimizer when setup exits"""
def __init__(self, *a, **kw):
develop.__init__(self, *a, **kw)
atexit.register(
call, [sys.executable, '-m', 'calmjs.parse.parsers.optimize'])


class InstallHook(install):
"""For hooking the optimizer when setup exits"""
def __init__(self, *a, **kw):
install.__init__(self, *a, **kw)
atexit.register(
call, [sys.executable, '-m', 'calmjs.parse.parsers.optimize'])


version = '0.9.0'

classifiers = """
Expand Down Expand Up @@ -41,13 +61,14 @@
namespace_packages=['calmjs'],
include_package_data=True,
zip_safe=False,
cmdclass={
'develop': DevelopHook,
'install': InstallHook,
},
install_requires=[
'ply>=3.6',
],
entry_points="""
# -*- Entry points: -*-
""",
entry_points={
},
test_suite="calmjs.parse.tests.make_suite",
)

call([sys.executable, '-m', 'calmjs.parse.parsers.optimize'])

0 comments on commit 535aab8

Please sign in to comment.