From 3c5d4bfeeabd90a02d5fda30f38e720006da62b0 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Thu, 1 Dec 2011 14:13:39 -0500 Subject: [PATCH] Bug 706928 - Refactor mozinfo, mozinstall and manifestdestiny to be proper python modules --- manifestdestiny/manifestparser/__init__.py | 38 ++++++++++++++++ .../{ => manifestparser}/manifestparser.py | 45 ------------------- manifestdestiny/setup.py | 35 ++++++++++++++- mozhttpd/setup.py | 2 +- mozinfo/mozinfo/__init__.py | 39 ++++++++++++++++ mozinfo/{ => mozinfo}/mozinfo.py | 0 mozinfo/setup.py | 5 +-- mozinstall/mozinstall/__init__.py | 38 ++++++++++++++++ mozinstall/{ => mozinstall}/mozinstall.py | 0 mozinstall/setup.py | 5 +-- 10 files changed, 153 insertions(+), 54 deletions(-) create mode 100644 manifestdestiny/manifestparser/__init__.py rename manifestdestiny/{ => manifestparser}/manifestparser.py (95%) create mode 100644 mozinfo/mozinfo/__init__.py rename mozinfo/{ => mozinfo}/mozinfo.py (100%) create mode 100644 mozinstall/mozinstall/__init__.py rename mozinstall/{ => mozinstall}/mozinstall.py (100%) diff --git a/manifestdestiny/manifestparser/__init__.py b/manifestdestiny/manifestparser/__init__.py new file mode 100644 index 0000000..ea115a1 --- /dev/null +++ b/manifestdestiny/manifestparser/__init__.py @@ -0,0 +1,38 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is manifestdestiny. +# +# The Initial Developer of the Original Code is +# The Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2010 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Jeff Hammel (Original author) +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +from manifestparser import * diff --git a/manifestdestiny/manifestparser.py b/manifestdestiny/manifestparser/manifestparser.py similarity index 95% rename from manifestdestiny/manifestparser.py rename to manifestdestiny/manifestparser/manifestparser.py index 9872976..7f1d749 100755 --- a/manifestdestiny/manifestparser.py +++ b/manifestdestiny/manifestparser/manifestparser.py @@ -1005,49 +1005,6 @@ def __call__(self, options, args): for command in sorted(commands): print ' %s : %s' % (command, commands[command].__doc__.strip()) -class SetupCLI(CLICommand): - """ - setup using setuptools - """ - # use setup.py from the repo when you want to distribute to python! - # otherwise setuptools will complain that it can't find setup.py - # and result in a useless package - - usage = '%prog [options] setup [setuptools options]' - - def __call__(self, options, args): - sys.argv = [sys.argv[0]] + args - assert setup is not None, "You must have setuptools installed to use SetupCLI" - here = os.path.dirname(os.path.abspath(__file__)) - try: - filename = os.path.join(here, 'README.txt') - description = file(filename).read() - except: - description = '' - os.chdir(here) - - setup(name='ManifestDestiny', - version=version, - description="Universal manifests for Mozilla test harnesses", - long_description=description, - classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers - keywords='mozilla manifests', - author='Jeff Hammel', - author_email='jhammel@mozilla.com', - url='https://wiki.mozilla.org/Auto-tools/Projects/ManifestDestiny', - license='MPL', - zip_safe=False, - py_modules=['manifestparser'], - install_requires=[ - # -*- Extra requirements: -*- - ], - entry_points=""" - [console_scripts] - manifestparser = manifestparser:main - """, - ) - - class UpdateCLI(CLICommand): """ update the tests as listed in a manifest from a directory @@ -1081,8 +1038,6 @@ def __call__(self, options, args): 'help': HelpCLI, 'update': UpdateCLI, 'write': WriteCLI } -if setup is not None: - commands['setup'] = SetupCLI def main(args=sys.argv[1:]): """console_script entry point""" diff --git a/manifestdestiny/setup.py b/manifestdestiny/setup.py index 7b26572..0922b19 100644 --- a/manifestdestiny/setup.py +++ b/manifestdestiny/setup.py @@ -41,6 +41,37 @@ # otherwise setuptools will complain that it can't find setup.py # and result in a useless package +from setuptools import setup, find_packages import sys -from manifestparser import SetupCLI -SetupCLI(None)(None, sys.argv[1:]) +import os + +here = os.path.dirname(os.path.abspath(__file__)) +try: + filename = os.path.join(here, 'README.txt') + description = file(filename).read() +except: + description = '' + +PACKAGE_NAME = "ManifestDestiny" +PACKAGE_VERSION = "0.5.4" + +setup(name=PACKAGE_NAME, + version=PACKAGE_VERSION, + description="Universal manifests for Mozilla test harnesses", + long_description=description, + classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers + keywords='mozilla manifests', + author='Jeff Hammel', + author_email='jhammel@mozilla.com', + url='https://github.com/mozilla/mozbase/tree/master/manifestdestiny', + license='MPL', + zip_safe=False, + packages=find_packages(exclude=['legacy']), + install_requires=[ + # -*- Extra requirements: -*- + ], + entry_points=""" + [console_scripts] + manifestparser = manifestparser:main + """, + ) diff --git a/mozhttpd/setup.py b/mozhttpd/setup.py index cab14b9..6f7a969 100644 --- a/mozhttpd/setup.py +++ b/mozhttpd/setup.py @@ -36,7 +36,7 @@ # ***** END LICENSE BLOCK ***** import os -from setuptools import setup +from setuptools import setup, find_packages try: here = os.path.dirname(os.path.abspath(__file__)) diff --git a/mozinfo/mozinfo/__init__.py b/mozinfo/mozinfo/__init__.py new file mode 100644 index 0000000..b113c6c --- /dev/null +++ b/mozinfo/mozinfo/__init__.py @@ -0,0 +1,39 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozinfo. +# +# The Initial Developer of the Original Code is +# The Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2010 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Jeff Hammel +# Clint Talbert +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +from mozinfo import * diff --git a/mozinfo/mozinfo.py b/mozinfo/mozinfo/mozinfo.py similarity index 100% rename from mozinfo/mozinfo.py rename to mozinfo/mozinfo/mozinfo.py diff --git a/mozinfo/setup.py b/mozinfo/setup.py index ec1172a..f1f0e61 100644 --- a/mozinfo/setup.py +++ b/mozinfo/setup.py @@ -37,7 +37,7 @@ import os -from setuptools import setup +from setuptools import setup, find_packages version = '0.3.3' @@ -65,8 +65,7 @@ author_email='jhammel@mozilla.com', url='https://wiki.mozilla.org/Auto-tools', license='MPL', - py_modules=['mozinfo'], - packages=[], + packages=find_packages(exclude=['legacy']), include_package_data=True, zip_safe=False, install_requires=deps, diff --git a/mozinstall/mozinstall/__init__.py b/mozinstall/mozinstall/__init__.py new file mode 100644 index 0000000..1b01d92 --- /dev/null +++ b/mozinstall/mozinstall/__init__.py @@ -0,0 +1,38 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozinstall. +# +# The Initial Developer of the Original Code is +# The Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2011 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Clint Talbert +# Andrew Halberstadt +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** +from mozinstall import * diff --git a/mozinstall/mozinstall.py b/mozinstall/mozinstall/mozinstall.py similarity index 100% rename from mozinstall/mozinstall.py rename to mozinstall/mozinstall/mozinstall.py diff --git a/mozinstall/setup.py b/mozinstall/setup.py index f13034e..aebc6ec 100644 --- a/mozinstall/setup.py +++ b/mozinstall/setup.py @@ -37,7 +37,7 @@ # ***** END LICENSE BLOCK ***** import os -from setuptools import setup +from setuptools import setup, find_packages try: here = os.path.dirname(os.path.abspath(__file__)) @@ -66,8 +66,7 @@ author_email='mdas@mozilla.com', url='https://github.com/mozilla/mozbase', license='MPL', - py_modules=['mozinstall'], - packages=[], + packages=find_packages(exclude=['legacy']), include_package_data=True, zip_safe=False, install_requires=deps,