Bug 1183291 - Factor idl-parser into a Python package. r=khuey

Move Python code into an xpidl subdirectory, and include a setup.py to allow
inclusion from pip install or requirements files. Change build directory
variables appropriately.
This commit is contained in:
Peter Elmers 2015-07-13 13:09:11 -07:00
parent 0e3e4adfee
commit 9295a3b690
11 changed files with 25 additions and 6 deletions

View File

@ -16,9 +16,9 @@ import sys
from io import BytesIO
from buildconfig import topsrcdir
from header import print_header
from typelib import write_typelib
from xpidl import IDLParser
from xpidl.header import print_header
from xpidl.typelib import write_typelib
from xpidl.xpidl import IDLParser
from xpt import xpt_link
from mozbuild.makeutil import Makefile

15
xpcom/idl-parser/setup.py Normal file
View File

@ -0,0 +1,15 @@
from setuptools import setup, find_packages
setup(
name='xpidl',
version='1.0',
description='Parser and header generator for xpidl files.',
author='Mozilla Foundation',
license='MPL 2.0',
packages=find_packages(),
install_requires=['ply>=3.6,<4.0'],
url='https://github.com/pelmers/xpidl',
entry_points={'console_scripts': ['header.py = xpidl.header:main']},
keywords=['xpidl', 'parser']
)

View File

View File

@ -501,7 +501,8 @@ def write_interface(iface, fd):
fd.write(iface_template_epilog)
if __name__ == '__main__':
def main():
from optparse import OptionParser
o = OptionParser()
o.add_option('-I', action='append', dest='incdirs', default=['.'],
@ -569,3 +570,6 @@ if __name__ == '__main__':
print >>depfd, "%s: %s" % (options.outfile, " ".join(deps))
for dep in deps:
print >>depfd, "%s:" % dep
if __name__ == '__main__':
main()

View File

@ -8,7 +8,7 @@ with Files('**'):
BUG_COMPONENT = ('Core', 'XPCOM')
DIRS += [
'idl-parser',
'idl-parser/xpidl',
]
DIRS += [

View File

@ -4,7 +4,7 @@
export::
ifndef LIBXUL_SDK
$(call SUBMAKE,xpidl-parser,$(DEPTH)/xpcom/idl-parser)
$(call SUBMAKE,xpidl-parser,$(DEPTH)/xpcom/idl-parser/xpidl)
endif
$(call py_action,process_install_manifest,$(DIST)/idl $(DEPTH)/_build_manifests/install/dist_idl)
$(call SUBMAKE,xpidl,$(DEPTH)/config/makefiles/xpidl)