diff --git a/python/mozbuild/mozbuild/action/xpidl-process.py b/python/mozbuild/mozbuild/action/xpidl-process.py index 6a8f58dfd8e..3fc07418210 100755 --- a/python/mozbuild/mozbuild/action/xpidl-process.py +++ b/python/mozbuild/mozbuild/action/xpidl-process.py @@ -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 diff --git a/xpcom/idl-parser/setup.py b/xpcom/idl-parser/setup.py new file mode 100644 index 00000000000..f42edbb9917 --- /dev/null +++ b/xpcom/idl-parser/setup.py @@ -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'] +) diff --git a/xpcom/idl-parser/Makefile.in b/xpcom/idl-parser/xpidl/Makefile.in similarity index 100% rename from xpcom/idl-parser/Makefile.in rename to xpcom/idl-parser/xpidl/Makefile.in diff --git a/xpcom/idl-parser/xpidl/__init__.py b/xpcom/idl-parser/xpidl/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpcom/idl-parser/header.py b/xpcom/idl-parser/xpidl/header.py similarity index 99% rename from xpcom/idl-parser/header.py rename to xpcom/idl-parser/xpidl/header.py index 74a77ff6f23..4ed76a17f26 100644 --- a/xpcom/idl-parser/header.py +++ b/xpcom/idl-parser/xpidl/header.py @@ -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() diff --git a/xpcom/idl-parser/moz.build b/xpcom/idl-parser/xpidl/moz.build similarity index 100% rename from xpcom/idl-parser/moz.build rename to xpcom/idl-parser/xpidl/moz.build diff --git a/xpcom/idl-parser/runtests.py b/xpcom/idl-parser/xpidl/runtests.py similarity index 100% rename from xpcom/idl-parser/runtests.py rename to xpcom/idl-parser/xpidl/runtests.py diff --git a/xpcom/idl-parser/typelib.py b/xpcom/idl-parser/xpidl/typelib.py similarity index 100% rename from xpcom/idl-parser/typelib.py rename to xpcom/idl-parser/xpidl/typelib.py diff --git a/xpcom/idl-parser/xpidl.py b/xpcom/idl-parser/xpidl/xpidl.py similarity index 100% rename from xpcom/idl-parser/xpidl.py rename to xpcom/idl-parser/xpidl/xpidl.py diff --git a/xpcom/moz.build b/xpcom/moz.build index 3e1a89990c9..d2792b82eaf 100644 --- a/xpcom/moz.build +++ b/xpcom/moz.build @@ -8,7 +8,7 @@ with Files('**'): BUG_COMPONENT = ('Core', 'XPCOM') DIRS += [ - 'idl-parser', + 'idl-parser/xpidl', ] DIRS += [ diff --git a/xpcom/xpidl/Makefile.in b/xpcom/xpidl/Makefile.in index e5ba594380b..ec43f7c27dc 100644 --- a/xpcom/xpidl/Makefile.in +++ b/xpcom/xpidl/Makefile.in @@ -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)