<commit_before>#!/usr/bin/env python
# encoding: utf-8

from __future__ import print_function

import os
import sys
import codecs

try:
	from setuptools.core import setup, find_packages
except ImportError:
	from setuptools import setup, find_packages

from setuptools.command.test import test as TestCommand

if sys.version_info < (2, 7):
	raise SystemExit("Python 2.7 or later is required.")
elif sys.version_info > (3, 0) and sys.version_info < (3, 3):
	raise SystemExit("Python 3.3 or later is required.")

exec(open(os.path.join("web", "blueprint", "release.py")).read())

class PyTest(TestCommand):
	def finalize_options(self):
		TestCommand.finalize_options(self)

		self.test_args = []
		self.test_suite = True

	def run_tests(self):
		import pytest
		sys.exit(pytest.main(self.test_args))

here = os.path.abspath(os.path.dirname(__file__))

tests_require = [
		'pytest',  # test collector and extensible runner
		'pytest-cov',  # coverage reporting
		'pytest-flakes',  # syntax validation
		'pytest-cagoule',  # intelligent test execution
		'pytest-spec',  # output formatting
	]

setup(
	name = "WebCore",
	version = version,

	description = description,
	long_description = codecs.open(os.path.join(here, 'README.rst'), 'r', 'utf8').read(),
	url = url,
	download_url = 'http://s.webcore.io/aIly',

	author = author.name,
	author_email = author.email,

	license = 'MIT',
	keywords = '',
	classifiers = [
			"Development Status :: 5 - Production/Stable",
			"Environment :: Console",
			"Environment :: Web Environment",
			"Intended Audience :: Developers",
			"License :: OSI Approved :: MIT License",
			"Operating System :: OS Independent",
			"Programming Language :: Python",
			"Programming Language :: Python :: 2",
			"Programming Language :: Python :: 2.6",
			"Programming Language :: Python :: 2.7",
			"Programming Language :: Python :: 3",
			"Programming Language :: Python :: 3.2",
			"Programming Language :: Python :: 3.3",
			"Programming Language :: Python :: 3.4",
			"Programming Language :: Python :: Implementation :: CPython",
			"Programming Language :: Python :: Implementation :: PyPy",
			"Topic :: Internet :: WWW/HTTP :: WSGI",
			"Topic :: Software Development :: Libraries :: Python Modules",
		],

	packages = find_packages(exclude=['bench', 'docs', 'example', 'test']),
	include_package_data = True,
	namespace_packages = [
			'web',  # primary namespace
			'web.app',  # application code goes here
			'web.blueprint',  # quick-start templates
			'web.component',  # contentment pluggable components
			'web.component.file',  # do not use
			'web.component.file.backend',  # file storage back-ends
			'web.component.page',  # do not use
			'web.component.page.block',  # embeddable blocks
			'web.cli',  # extensible command-line interface and scripts
			'web.dispatch',  # extensible dispatch mechanisms
			'web.ext',  # framework extensions
			'web.rpc',  # alternate transport mechanisms
			'web.server',  # front-end WSGI bridges
			'web.theme',  # HTML theme and widget plugins for contentment
		],

	entry_points = {
			'marrow.blueprint': [
					# Core
					'webcore.small = web.blueprint.small:SmallBlueprint',  # small collection of files
					'webcore.medium = web.blueprint.medium:MediumBlueprint',  # lightly structured application
					'webcore.large = web.blueprint.large:LargeBlueprint',  # full MVC separation and structure

					# Contentment
					# single deployable application, fully dynamic; development and small sites
					'contentment.solo = web.blueprint.contentment.solo:SoloBlueprint',
					# local write, static read application; blogs and GitHub Pages
					'contentment.static = web.blueprint.contentment.static:StaticBlueprint',
					# dynamic write, static read application; high-availability, large-scale applications
					'contentment.hybrid = web.blueprint.contentment.hybrid:HybridBlueprint',
				],
		},

	install_requires = [
			'web.template<3.0.0',  # extensible template engine support
			'marrow.package<2.0',  # dynamic execution and plugin management
			'pyyaml',  # rich data interchange format; used for configuration
		],

	extras_require = dict(
			development = tests_require,
			contentment = contentment_require,
		),

	tests_require = tests_require,

	dependency_links = [],

	zip_safe = True,
	cmdclass = dict(
			test = PyTest,
		)
)
<commit_msg>Removed Contentment-specific dependencies.<commit_after>#!/usr/bin/env python
# encoding: utf-8

from __future__ import print_function

import os
import sys
import codecs

try:
	from setuptools.core import setup, find_packages
except ImportError:
	from setuptools import setup, find_packages

from setuptools.command.test import test as TestCommand

if sys.version_info < (2, 7):
	raise SystemExit("Python 2.7 or later is required.")
elif sys.version_info > (3, 0) and sys.version_info < (3, 3):
	raise SystemExit("Python 3.3 or later is required.")

exec(open(os.path.join("web", "blueprint", "release.py")).read())

class PyTest(TestCommand):
	def finalize_options(self):
		TestCommand.finalize_options(self)

		self.test_args = []
		self.test_suite = True

	def run_tests(self):
		import pytest
		sys.exit(pytest.main(self.test_args))

here = os.path.abspath(os.path.dirname(__file__))

tests_require = [
		'pytest',  # test collector and extensible runner
		'pytest-cov',  # coverage reporting
		'pytest-flakes',  # syntax validation
		'pytest-cagoule',  # intelligent test execution
		'pytest-spec',  # output formatting
	]

setup(
	name = "WebCore",
	version = version,

	description = description,
	long_description = codecs.open(os.path.join(here, 'README.rst'), 'r', 'utf8').read(),
	url = url,
	download_url = 'http://s.webcore.io/aIly',

	author = author.name,
	author_email = author.email,

	license = 'MIT',
	keywords = '',
	classifiers = [
			"Development Status :: 5 - Production/Stable",
			"Environment :: Console",
			"Environment :: Web Environment",
			"Intended Audience :: Developers",
			"License :: OSI Approved :: MIT License",
			"Operating System :: OS Independent",
			"Programming Language :: Python",
			"Programming Language :: Python :: 2",
			"Programming Language :: Python :: 2.6",
			"Programming Language :: Python :: 2.7",
			"Programming Language :: Python :: 3",
			"Programming Language :: Python :: 3.2",
			"Programming Language :: Python :: 3.3",
			"Programming Language :: Python :: 3.4",
			"Programming Language :: Python :: Implementation :: CPython",
			"Programming Language :: Python :: Implementation :: PyPy",
			"Topic :: Internet :: WWW/HTTP :: WSGI",
			"Topic :: Software Development :: Libraries :: Python Modules",
		],

	packages = find_packages(exclude=['bench', 'docs', 'example', 'test']),
	include_package_data = True,
	namespace_packages = [
			'web',  # primary namespace
			'web.blueprint',  # quick-start templates
		],

	entry_points = {
			'marrow.blueprint': [
					# Core
					'webcore.small = web.blueprint.small:SmallBlueprint',  # small collection of files
					'webcore.medium = web.blueprint.medium:MediumBlueprint',  # lightly structured application
					'webcore.large = web.blueprint.large:LargeBlueprint',  # full MVC separation and structure

					# Contentment
					# single deployable application, fully dynamic; development and small sites
					'contentment.solo = web.blueprint.contentment.solo:SoloBlueprint',
					# local write, static read application; blogs and GitHub Pages
					'contentment.static = web.blueprint.contentment.static:StaticBlueprint',
					# dynamic write, static read application; high-availability, large-scale applications
					'contentment.hybrid = web.blueprint.contentment.hybrid:HybridBlueprint',
				],
		},

	install_requires = [
			'web.template<3.0.0',  # extensible template engine support
			'marrow.package<2.0',  # dynamic execution and plugin management
			'pyyaml',  # rich data interchange format; used for configuration
		],

	extras_require = dict(
			development = tests_require,
		),

	tests_require = tests_require,

	dependency_links = [],

	zip_safe = True,
	cmdclass = dict(
			test = PyTest,
		)
)
<|endoftext|>


<commit_before>from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys

class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pytest
        errcode = pytest.main(self.test_args)
        sys.exit(errcode)

INSTALL_REQUIRES = ['astropy>=1.0', 'numpy', 'ccdproc>=0.3.1']

setup(
    name='msumastro',
    version='0.8.6',
    description='Process FITS files',
    url='http://github.com/mwcraig/msumastro',
    long_description=(open('README.rst').read()),
    license='BSD 3-clause',
    author='Matt Craig',
    author_email='mcraig@mnstate.edu',
    packages=find_packages(exclude=['tests*']),
    include_package_data=True,
    install_requires=INSTALL_REQUIRES,
    extras_require={
        'docs': ['numpydoc', 'sphinx-argparse', 'sphinx_rtd_theme', 'astropy-helpers'],
    },
    tests_require=['scipy', 'pytest>=2.9', 'pytest-capturelog'] + INSTALL_REQUIRES,
    cmdclass={'test': PyTest},
    entry_points={
        'console_scripts': [
            ('quick_add_keys_to_file.py = '
             'msumastro.scripts.quick_add_keys_to_file:main'),
            ('run_patch.py = '
             'msumastro.scripts.run_patch:main'),
            ('run_astrometry.py = '
             'msumastro.scripts.run_astrometry:main'),
            ('run_triage.py = '
             'msumastro.scripts.run_triage:main'),
            ('run_standard_header_process.py = '
             'msumastro.scripts.run_standard_header_process:main'),
            ('sort_files.py = '
             'msumastro.scripts.sort_files:main')
        ]
    },
    classifiers=['Development Status :: 4 - Beta',
                 'License :: OSI Approved :: BSD License',
                 'Programming Language :: Python :: 2.7',
                 'Programming Language :: Python :: 2 :: Only',
                 'Intended Audience :: Science/Research',
                 'Topic :: Scientific/Engineering :: Astronomy'],
    )
<commit_msg>Update ccdproc requirement<commit_after>from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys

class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pytest
        errcode = pytest.main(self.test_args)
        sys.exit(errcode)

INSTALL_REQUIRES = ['astropy>=1.0', 'numpy', 'ccdproc>=1.0']

setup(
    name='msumastro',
    version='0.8.6',
    description='Process FITS files',
    url='http://github.com/mwcraig/msumastro',
    long_description=(open('README.rst').read()),
    license='BSD 3-clause',
    author='Matt Craig',
    author_email='mcraig@mnstate.edu',
    packages=find_packages(exclude=['tests*']),
    include_package_data=True,
    install_requires=INSTALL_REQUIRES,
    extras_require={
        'docs': ['numpydoc', 'sphinx-argparse', 'sphinx_rtd_theme', 'astropy-helpers'],
    },
    tests_require=['scipy', 'pytest>=2.9', 'pytest-capturelog'] + INSTALL_REQUIRES,
    cmdclass={'test': PyTest},
    entry_points={
        'console_scripts': [
            ('quick_add_keys_to_file.py = '
             'msumastro.scripts.quick_add_keys_to_file:main'),
            ('run_patch.py = '
             'msumastro.scripts.run_patch:main'),
            ('run_astrometry.py = '
             'msumastro.scripts.run_astrometry:main'),
            ('run_triage.py = '
             'msumastro.scripts.run_triage:main'),
            ('run_standard_header_process.py = '
             'msumastro.scripts.run_standard_header_process:main'),
            ('sort_files.py = '
             'msumastro.scripts.sort_files:main')
        ]
    },
    classifiers=['Development Status :: 4 - Beta',
                 'License :: OSI Approved :: BSD License',
                 'Programming Language :: Python :: 2.7',
                 'Programming Language :: Python :: 2 :: Only',
                 'Intended Audience :: Science/Research',
                 'Topic :: Scientific/Engineering :: Astronomy'],
    )
<|endoftext|>


<commit_before>from setuptools import setup

setup(
    name='cat',
    packages=['cat'],
    include_package_data=True,
    install_requires=[
        'flask',
        'jinja2',
        'pyquery',
        'requests', # needed by bin/check_site.py
    ],
    #setup_requires=[
    #    'pytest-runner',
    #],
    tests_require=[
        'pytest',
    ],
)

# vim: expandtab
<commit_msg>Update setup.py (#632)<commit_after>from setuptools import setup

setup(
    name = 'cat',
    packages = ['cat'],
    include_package_data = True,
    install_requires = [
        'flask',
        'jinja2',
        'pyquery',
        'requests', # needed by bin/check_site.py
    ],
    #setup_requires=[
    #    'pytest-runner',
    #],
    tests_require = [
        'pytest',
    ],
)

# vim: expandtab
<|endoftext|>


<commit_before>"""
To build distribution: python setup.py sdist bdist_wheel --universal
"""
import os
import setuptools
import openapiart
import requests
import shutil

pkg_name = "snappi"
go_pkg_name = "gosnappi"
model_protobuf_name = "otg"
version = "0.7.32"
models_version = "0.7.12"

# read long description from readme.md
base_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base_dir, "readme.md")) as fd:
    long_description = fd.read()

# download openapi.yaml
openapi_url = "https://github.com/open-traffic-generator/models/releases/download/v{version}/openapi.yaml".format(
    version=models_version
)
response = requests.request("GET", openapi_url, allow_redirects=True)
assert response.status_code == 200
with open(os.path.join("openapi.yaml"), "wb") as fp:
    fp.write(response.content)

openapiart.OpenApiArt(
    api_files=["openapi.yaml"],
    protobuf_name=model_protobuf_name,
    artifact_dir="artifacts",
    extension_prefix=pkg_name,
).GeneratePythonSdk(package_name=pkg_name).GenerateGoSdk(
    package_dir="github.com/open-traffic-generator/snappi/%s" % go_pkg_name, package_name=go_pkg_name
).GenerateGoServer(
    module_path="github.com/open-traffic-generator/snappi/%s" % go_pkg_name,
    models_prefix=go_pkg_name,
    models_path="github.com/open-traffic-generator/snappi/%s" % go_pkg_name
).GoTidy(relative_package_dir=go_pkg_name)

if os.path.exists(pkg_name):
    shutil.rmtree(pkg_name, ignore_errors=True)

# remove unwanted files
shutil.copytree(os.path.join("artifacts", pkg_name), pkg_name)
shutil.copyfile(
    os.path.join(base_dir, "artifacts", model_protobuf_name + ".proto"),
    os.path.join(base_dir, model_protobuf_name + ".proto")
)
shutil.rmtree("artifacts", ignore_errors=True)
for name in os.listdir(pkg_name):
    path = os.path.join(pkg_name, name)
    print(path + " will be published")

doc_dir = os.path.join(pkg_name, "docs")
os.mkdir(doc_dir)
shutil.move("openapi.yaml", doc_dir)

with open("models-release", "w") as out:
    out.write("v" + models_version)

setuptools.setup(
    name=pkg_name,
    version=version,
    description="The Snappi Open Traffic Generator Python Package",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/open-traffic-generator/snappi",
    author="ajbalogh",
    author_email="andy.balogh@keysight.com",
    license="MIT",
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Testing :: Traffic Generation",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
    ],
    keywords="snappi testing open traffic generator automation",
    include_package_data=True,
    packages=[pkg_name],
    python_requires=">=2.7, <4",
    install_requires=[
        "requests",
        "pyyaml",
        "jsonpath-ng",
        "typing",
        "typing-extensions",
        "grpcio==1.38.0 ; python_version > '2.7'", # Warning - changing versions need thorough investigation
        "grpcio-tools==1.38.0 ; python_version > '2.7'", # Warning - changing versions need thorough investigation
        "grpcio==1.35.0 ; python_version == '2.7'", # Warning - changing versions need thorough investigation
        "grpcio-tools==1.35.0 ; python_version == '2.7'", # Warning - changing versions need thorough investigation
        "protobuf==3.15.0" # Warning - changing versions need thorough investigation
    ],
    extras_require={
        "ixnetwork": ["snappi_ixnetwork==0.7.8"],
        "trex": ["snappi_trex"],
        "convergence": ["snappi_convergence==0.2.2"],
        "testing": ["pytest", "flask"],
    },
)
<commit_msg>revert version<commit_after>"""
To build distribution: python setup.py sdist bdist_wheel --universal
"""
import os
import setuptools
import openapiart
import requests
import shutil

pkg_name = "snappi"
go_pkg_name = "gosnappi"
model_protobuf_name = "otg"
version = "0.7.33"
models_version = "0.7.12"

# read long description from readme.md
base_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(base_dir, "readme.md")) as fd:
    long_description = fd.read()

# download openapi.yaml
openapi_url = "https://github.com/open-traffic-generator/models/releases/download/v{version}/openapi.yaml".format(
    version=models_version
)
response = requests.request("GET", openapi_url, allow_redirects=True)
assert response.status_code == 200
with open(os.path.join("openapi.yaml"), "wb") as fp:
    fp.write(response.content)

openapiart.OpenApiArt(
    api_files=["openapi.yaml"],
    protobuf_name=model_protobuf_name,
    artifact_dir="artifacts",
    extension_prefix=pkg_name,
).GeneratePythonSdk(package_name=pkg_name).GenerateGoSdk(
    package_dir="github.com/open-traffic-generator/snappi/%s" % go_pkg_name, package_name=go_pkg_name
).GenerateGoServer(
    module_path="github.com/open-traffic-generator/snappi/%s" % go_pkg_name,
    models_prefix=go_pkg_name,
    models_path="github.com/open-traffic-generator/snappi/%s" % go_pkg_name
).GoTidy(relative_package_dir=go_pkg_name)

if os.path.exists(pkg_name):
    shutil.rmtree(pkg_name, ignore_errors=True)

# remove unwanted files
shutil.copytree(os.path.join("artifacts", pkg_name), pkg_name)
shutil.copyfile(
    os.path.join(base_dir, "artifacts", model_protobuf_name + ".proto"),
    os.path.join(base_dir, model_protobuf_name + ".proto")
)
shutil.rmtree("artifacts", ignore_errors=True)
for name in os.listdir(pkg_name):
    path = os.path.join(pkg_name, name)
    print(path + " will be published")

doc_dir = os.path.join(pkg_name, "docs")
os.mkdir(doc_dir)
shutil.move("openapi.yaml", doc_dir)

with open("models-release", "w") as out:
    out.write("v" + models_version)

setuptools.setup(
    name=pkg_name,
    version=version,
    description="The Snappi Open Traffic Generator Python Package",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/open-traffic-generator/snappi",
    author="ajbalogh",
    author_email="andy.balogh@keysight.com",
    license="MIT",
    classifiers=[
        "Development Status :: 3 - Alpha",
        "Intended Audience :: Developers",
        "Topic :: Software Development :: Testing :: Traffic Generation",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
    ],
    keywords="snappi testing open traffic generator automation",
    include_package_data=True,
    packages=[pkg_name],
    python_requires=">=2.7, <4",
    install_requires=[
        "requests",
        "pyyaml",
        "jsonpath-ng",
        "typing",
        "typing-extensions",
        "grpcio==1.38.0 ; python_version > '2.7'", # Warning - changing versions need thorough investigation
        "grpcio-tools==1.38.0 ; python_version > '2.7'", # Warning - changing versions need thorough investigation
        "grpcio==1.35.0 ; python_version == '2.7'", # Warning - changing versions need thorough investigation
        "grpcio-tools==1.35.0 ; python_version == '2.7'", # Warning - changing versions need thorough investigation
        "protobuf==3.15.0" # Warning - changing versions need thorough investigation
    ],
    extras_require={
        "ixnetwork": ["snappi_ixnetwork==0.7.8"],
        "trex": ["snappi_trex"],
        "convergence": ["snappi_convergence==0.2.2"],
        "testing": ["pytest", "flask"],
    },
)
<|endoftext|>


<commit_before>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2010-2018 OneLogin, Inc.
# MIT License

from setuptools import setup

setup(
    name='python-saml',
    version='2.4.1',
    description='Onelogin Python Toolkit. Add SAML support to your Python software using this library',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2.7',
    ],
    author='OneLogin',
    author_email='support@onelogin.com',
    license='MIT',
    url='https://github.com/onelogin/python-saml',
    packages=['onelogin', 'onelogin/saml2'],
    include_package_data=True,
    package_data={
            'onelogin/saml2/schemas': ['*.xsd'],
    },
    package_dir={
        '': 'src',
    },
    test_suite='tests',
    install_requires=[
        'dm.xmlsec.binding==1.3.3',
        'isodate>=0.5.0',
        'defusedxml>=0.4.1',
    ],
    extras_require={
        'test': (
            'coverage>=3.6',
            'freezegun==0.3.5',
            'pylint==1.9.1',
            'pep8==1.5.7',
            'pyflakes==0.8.1',
            'coveralls==1.1',
        ),
    },
    keywords='saml saml2 xmlsec django flask',
)
<commit_msg>Update dm.xmlsec.binding dependency to 1.3.7<commit_after>#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2010-2018 OneLogin, Inc.
# MIT License

from setuptools import setup

setup(
    name='python-saml',
    version='2.4.1',
    description='Onelogin Python Toolkit. Add SAML support to your Python software using this library',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Intended Audience :: System Administrators',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2.7',
    ],
    author='OneLogin',
    author_email='support@onelogin.com',
    license='MIT',
    url='https://github.com/onelogin/python-saml',
    packages=['onelogin', 'onelogin/saml2'],
    include_package_data=True,
    package_data={
            'onelogin/saml2/schemas': ['*.xsd'],
    },
    package_dir={
        '': 'src',
    },
    test_suite='tests',
    install_requires=[
        'dm.xmlsec.binding==1.3.7',
        'isodate>=0.5.0',
        'defusedxml>=0.4.1',
    ],
    extras_require={
        'test': (
            'coverage>=3.6',
            'freezegun==0.3.5',
            'pylint==1.9.1',
            'pep8==1.5.7',
            'pyflakes==0.8.1',
            'coveralls==1.1',
        ),
    },
    keywords='saml saml2 xmlsec django flask',
)
<|endoftext|>


<commit_before>#!/usr/bin/env python2
#"""
#    This script should help setting up environment for lever.
#    Run it without arguments, and it just setups the environment.
#    Run it with 'compile' -argument, eg. "./setup.py compile" and it compiles.
#
#    Compiling takes some time to finish.
#"""
from StringIO import StringIO
from subprocess import call, check_call
from urllib import urlopen
from zipfile import ZipFile
import argparse
import glob
import os
import platform
import re
import sys

def main():
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()

    cmd = subparsers.add_parser('compile',
        help="Compile the lever runtime")
    cmd.set_defaults(func=compile_lever)
    cmd.add_argument("--lldebug", action="store_true",
        help="Compile in debug mode")
    cmd.add_argument("--nojit", action="store_true",
        help="Compile without jit")
    cmd.add_argument("--stm", action="store_true",
        help="Waiting for this day")
    cmd.add_argument("--use-pypy", action="store_true",
        help="Use pypy for compiling")

    cmd = subparsers.add_parser('compile-lib',
        help="Compile lib/ contents",
        description=compile_lib_desc)
    cmd.set_defaults(func=compile_lib)
    cmd.add_argument("--all", action="store_true",
        help="recompile all")

    cmd = subparsers.add_parser('win32-dist',
        help="Create win32 distribution",
        description=win32_dist.__doc__)
    cmd.set_defaults(func=win32_dist)

    cmd = subparsers.add_parser('refresh-docs',
        help="Refresh the source index and then update all documentation")
    cmd.add_argument("--tag", type=str, default="latest",
        help="Update doc/$tag instead of the doc/latest, should be done along new version releases.")
    cmd.set_defaults(func=refresh_docs)

    cmd = subparsers.add_parser('stub',
        help="Produce documentation stub for an item in the source index")
    cmd.add_argument("name", type=str)
    cmd.add_argument("--src", action="store_true",
        help="Produce just the source link tag")
    cmd.set_defaults(func=documentation_stub)

    cmd = subparsers.add_parser('update-html-docs',
        help="Update HTML documentation",
        description=update_html_docs.__doc__)
    cmd.add_argument("--tag", type=str, default="latest",
        help="Update doc/$tag instead of the doc/latest, should be done along new version releases.")
    cmd.set_defaults(func=update_html_docs)

    args = parser.parse_args()
    return args.func(args)

# On linux the system checks whether the tools required to build it respond.
# Then it checks whether the system has the required C libraries to have
# a chance of successful build.

# When there's a chance that the thing actually builds, it downloads and extracts
# pypy sources. PyPy changes often and the newer versions introduce nice improvements
# so an attempt has been made to keep up with the version changes.

# There's no need to compile pypy itself. We run rpython with python 2.7
# Presence of python 2.7 is not being checked, because if you can run this script,
# as described on the README, you should have python 2.x installed on your system.

# It's been 7 years after 2.7 has been released, and pretty much the libraries listed
# are stabilized, so I don't expect to have trouble with versions.
# Maybe it happens some day... On someone's computer. That he doesn't have recent enough
# versions of these libraries.
pypy_src_url = 'https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-src'
pypy_src_dir = os.path.basename(pypy_src_url)

# If the untagged 'pypy' -directory is around, we will use that.
# But the pypy_src_url is still downloaded.

# These are listed in "Building PyPy from Source":
#                     http://doc.pypy.org/en/latest/build.html
command_depends = "pkg-config gcc make bzip2".split(' ')
library_depends = "libffi zlib sqlite3 ncurses expat libssl".split(' ')

def compile_lever(args):
    system = platform.system()
    if system == "Linux":
        libuv_abs = os.path.abspath("local/libuv")
        if os.path.exists(libuv_abs):
            linux_build_depedencies(libuv_is_local=True)
            insert_to_env("DEPENDENCY_LIBRARY_PATH", os.path.join(libuv_abs, "out/Release"), ':')
            insert_to_env("DEPENDENCY_LIBRARY_PATH", os.path.join(libuv_abs, "out/Debug"),   ':')
            insert_to_env("DEPENDENCY_INCLUDE_PATH", os.path.join(libuv_abs, "include"),   ':')
        else:
            linux_build_depedencies(libuv_is_local=False)
    elif system == "Windows":
        windows_build_dependencies()
        local_abs = os.path.abspath("local")
        if os.path.exists(local_abs):
            insert_to_env('PATH',    os.path.join(local_abs, "bin"),     ';')
            insert_to_env('INCLUDE', os.path.join(local_abs, "include"), ';')
            insert_to_env('LIB',     os.path.join(local_abs, "lib"),     ';')
    else:
        assert False, "no dependency fetching script for {}".format(system)
    if os.path.exists('pypy'):
        os.environ['PYTHONPATH'] = 'pypy'
    else:
        os.environ['PYTHONPATH'] = pypy_src_dir
    rpython_bin = os.path.join(pypy_src_dir, 'rpython', 'bin', 'rpython')

    build_flags = []
    if not args.nojit:
        build_flags.append('--translation-jit')
    build_flags.append('--gc=incminimark')
    build_flags.append('--opt=2')
    if args.lldebug:
        build_flags.append('--lldebug')
    # PyPy STM was tried once. The plans are to
    # pick it up when it improves.
    if args.stm:
        build_flags.append('--stm')
    if args.use_pypy:
        check_call(['pypy', rpython_bin] +
            build_flags + ["runtime/goal_standalone.py"])
    else:
        check_call(['python', rpython_bin] +
            build_flags + ["runtime/goal_standalone.py"])
    compile_libraries(preserve_cache=False)

# To handle dependencies, I'm adding them into the environment
# variables before compiling.
def insert_to_env(name, path, separator):
    value = os.environ.get(name, '').strip()
    if value == "":
        os.environ[name] = path
    else:
        os.environ[name] = path + separator + value

# The 'libuv_is_local' here is a bit of a mess.
#
def linux_build_depedencies(libuv_is_local):
    devnull = open(os.devnull, 'w')
    for cmd in command_depends:
        if call([cmd, '--version'], stdout=devnull, stderr=devnull) != 0:
            return linux_troubleshoot(cmd)
    extra = []
    extra_apt = []
    if not libuv_is_local:
        extra.append("libuv")
        extra_apt.append("libuv1-dev")
    for dependency in library_depends + extra:
        if call(['pkg-config', '--exists', dependency]) != 0:
            return linux_troubleshoot(dependency, extra_apt)
    linux_download_and_extract(pypy_src_dir, pypy_src_url + '.tar.bz2')

# On windows, you're going to need Visual studio 9.0 and you need to
# know how to use it. (You might obtain it by checking for "visual studio for python 2.7")
# Having frequent releases start to seem relevant, so I may have to setup a build computer that
# automates it. Maybe some day...
def windows_build_dependencies():
    if not os.path.exists(pypy_src_dir):
        url = urlopen(pypy_src_url + '.zip')
        zipfile = ZipFile(StringIO(url.read()))
        zipfile.extractall()
        print("Note that building from source for windows isn't frequent.")

    if os.path.exists("local/include"):
        stdint_msvc2008_path = "local/include/stdint-msvc2008.h"
        if not os.path.exists(stdint_msvc2008_path):
            print("stdint-msvc2008.h missing, downloading it.")
            url = urlopen("https://raw.githubusercontent.com/libuv/libuv/v1.x/include/stdint-msvc2008.h")
            with open(stdint_msvc2008_path, 'wb') as fd:
                fd.write(url.read())

compile_lib_desc = """This command compiles the scripts in the lib/

If this command has not been run successfully,
the lever runtime will exclaim that bytecode
compiler is stale or missing.

This command is automatically run along the compile.
"""

def compile_lib(args):
    compile_libraries(not args.all)

def compile_libraries(preserve_cache=True):
    from compiler import compile
    import traceback
    print("Compiling libraries for lever")
    for dirname, subdirs, files in os.walk("lib"):
        for name in files:
            if name.endswith(".lc"):
                lc_name = os.path.join(dirname, name)
                cb_name = re.sub(".lc$", ".lc.cb", lc_name)
                # Compiling the whole `lib/` is not needed during development.
                # Chances are it will take whole lot of time eventually.
                # Trouble-free parsing isn't free.
                if preserve_cache and (os.path.isfile(cb_name)
                        and os.path.getmtime(cb_name) >= os.path.getmtime(lc_name)):
                    continue
                try:
                    compile.compile_file(cb_name, lc_name)
                except Exception as e:
                    if not isinstance(e, KeyError):
                        traceback.print_exc()
                    print("{}:{}".format(lc_name, e))

stop_troubleshoot = False
def linux_troubleshoot(item, extra_apt=[]):
    global stop_troubleshoot
    if stop_troubleshoot:
        print("That did not solve the problem")
        sys.exit(1)
    stop_troubleshoot = True
    print("Dependencies to compile or run:")
    print(' '.join(command_depends + library_depends))
    print()
    print("{} is missing".format(item))
    if re.search("ubuntu|debian", platform.platform(), re.IGNORECASE):
        print("Ubuntu/debian detected, trying to install")
        check_call(['sudo', 'apt-get', 'install'] +
            "gcc make libffi-dev pkg-config libz-dev libbz2-dev".split(' ') +
            "libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libuv1 libuv1-dev".split(' ') +
            extra_apt)
        print("Re-attempt")
        main()
    else:
        sys.exit(1)

def linux_download_and_extract(target, archive):
    if not os.path.exists(target):
        if len(glob.glob(target + '.tar.bz2')) == 0:
            check_call(['wget', archive])
        check_call(["tar", "-xf", target + '.tar.bz2'])

def win32_dist(args):
    """
        This script creates a win32 distribution for lever
    """
    import shutil
    if not os.path.exists("lever.exe"):
        print("Need something to distribute first. Run setup.py compile on win32")
        sys.exit(1)
    mtime = os.path.getmtime("lever.exe")
# I do not want to release stale distribution.
    for root, dirs, fils in os.walk("evaluator"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    for root, dirs, fils in os.walk("space"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    for root, dirs, fils in os.walk("runtime"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    if mtime > os.path.getmtime("lever.exe"):
        print("Stale executable, re-run setup.py compile on win32")
        sys.exit(1)
    VERSION = open("VERSION").read().strip()
    archive = 'lever-{}.zip'.format(VERSION)
    zf = zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED)
    def include(path, to=None):
        to = path if to is None else to
        assert not os.path.isabs(path)
        zf.write(path, os.path.join("lever", to))
    def include_dir(dirname):
        for root, dirs, fils in os.walk(dirname):
            for fil in fils:
                include(os.path.join(root, fil))
    def include_contents(dirname):
        for root, dirs, fils in os.walk(dirname):
            for fil in fils:
                path = os.path.join(root, fil)
                include(path, os.path.relpath(path, dirname))

    include("lever.exe")
    include("lever-0.8.0.grammar")
    include("VERSION")
    include_dir("app")
    include_dir("lib")
    include_dir("doc")

    include_dir("samples")
    include_dir("headers")
    include("LICENSE.md", "LICENSE.lever.txt")
    include_contents("win32_extras")

    zf.close()
    print os.path.abspath(archive)

def refresh_docs(args):
    assert check_call(["./lever", "tools/print_module_index.lc",
        'doc/source_index.json' ]) == 0
    update_html_docs(args)

def documentation_stub(args):
    if args.src:
        check_call(["./lever", "tools/print_stub.lc",
            "doc/source_index.json",
            "source", args.name])
    else:
        check_call(["./lever", "tools/print_stub.lc",
            "doc/source_index.json",
            "group", args.name])

def update_html_docs(args):
    """
        Updates the html docs at 'www/doc'. By default updates the 'latest'.
    """
    check_call(["./lever", "tools/update_html_docs.lc",
        'doc', 'www/doc/' + args.tag ])
    print '(as a reference for a maintainer) rsync -avz www/ name@dest:www'

if __name__=='__main__':
    main()
<commit_msg>the brand new build-local -command<commit_after>#!/usr/bin/env python2
#"""
#    This script should help setting up environment for lever.
#    Run it without arguments, and it just setups the environment.
#    Run it with 'compile' -argument, eg. "./setup.py compile" and it compiles.
#
#    Compiling takes some time to finish.
#"""
from StringIO import StringIO
from subprocess import call, check_call
from urllib import urlopen
from zipfile import ZipFile
import argparse
import glob
import os
import platform
import re
import sys

def main():
    parser = argparse.ArgumentParser()
    subparsers = parser.add_subparsers()

    cmd = subparsers.add_parser('build-local',
        help="Compile the statically linked third party dependencies for Lever")
    cmd.set_defaults(func=build_local)

    cmd = subparsers.add_parser('compile',
        help="Compile the lever runtime")
    cmd.set_defaults(func=compile_lever)
    cmd.add_argument("--lldebug", action="store_true",
        help="Compile in debug mode")
    cmd.add_argument("--nojit", action="store_true",
        help="Compile without jit")
    cmd.add_argument("--stm", action="store_true",
        help="Waiting for this day")
    cmd.add_argument("--use-pypy", action="store_true",
        help="Use pypy for compiling")

    cmd = subparsers.add_parser('compile-lib',
        help="Compile lib/ contents",
        description=compile_lib_desc)
    cmd.set_defaults(func=compile_lib)
    cmd.add_argument("--all", action="store_true",
        help="recompile all")

    cmd = subparsers.add_parser('win32-dist',
        help="Create win32 distribution",
        description=win32_dist.__doc__)
    cmd.set_defaults(func=win32_dist)

    cmd = subparsers.add_parser('refresh-docs',
        help="Refresh the source index and then update all documentation")
    cmd.add_argument("--tag", type=str, default="latest",
        help="Update doc/$tag instead of the doc/latest, should be done along new version releases.")
    cmd.set_defaults(func=refresh_docs)

    cmd = subparsers.add_parser('stub',
        help="Produce documentation stub for an item in the source index")
    cmd.add_argument("name", type=str)
    cmd.add_argument("--src", action="store_true",
        help="Produce just the source link tag")
    cmd.set_defaults(func=documentation_stub)

    cmd = subparsers.add_parser('update-html-docs',
        help="Update HTML documentation",
        description=update_html_docs.__doc__)
    cmd.add_argument("--tag", type=str, default="latest",
        help="Update doc/$tag instead of the doc/latest, should be done along new version releases.")
    cmd.set_defaults(func=update_html_docs)

    args = parser.parse_args()
    return args.func(args)

def build_local(args):
    root_dir = os.getcwd()
    local_abs = os.path.abspath("local")

    ninja_path = os.path.join(local_abs, "ninja")
    rule_git_clone("git://github.com/ninja-build/ninja.git", ninja_path, "release")

    zlib_path = os.path.join(local_abs, "zlib")
    rule_git_clone("git://github.com/madler/zlib.git", zlib_path, "v1.2.11")

    libuv_path = os.path.join(local_abs, "libuv")
    rule_git_clone("git://github.com/libuv/libuv.git", libuv_path, "v1.13.1")

    libuv_gyp_path = os.path.join(local_abs, "libuv", "build", "gyp")
    rule_git_clone("https://chromium.googlesource.com/external/gyp.git", libuv_gyp_path)

    ninja_bin = os.path.join(local_abs, "ninja/ninja")
    if not os.path.exists(ninja_bin):
        os.chdir(ninja_path)
        check_call([os.path.join(ninja_path, "configure.py"), "--bootstrap"])

    if not os.path.exists(os.path.join(zlib_path, "build.ninja")):
        os.chdir(zlib_path)
        insert_to_env("PATH", ninja_path) # cmake requires this.
        check_call(["cmake", "-G", "Ninja"])

    libuv_build_path = os.path.join(libuv_path, "out", "Release")
    if not os.path.exists(os.path.join(libuv_build_path, "build.ninja")):
        os.chdir(libuv_path)
        check_call([os.path.join(libuv_path, "gyp_uv.py"), "-f", "ninja"])

    check_call(["ninja", "-C", zlib_path, "libz.a"])
    check_call(["ninja", "-C", libuv_build_path, "libuv.a"])

def rule_git_clone(url, dst, branch):
    if not os.path.exists(dst):
        check_call(["git", "clone", "--depth", "1", "-b", branch, url, dst])

# On linux the system checks whether the tools required to build it respond.
# Then it checks whether the system has the required C libraries to have
# a chance of successful build.

# When there's a chance that the thing actually builds, it downloads and extracts
# pypy sources. PyPy changes often and the newer versions introduce nice improvements
# so an attempt has been made to keep up with the version changes.

# There's no need to compile pypy itself. We run rpython with python 2.7
# Presence of python 2.7 is not being checked, because if you can run this script,
# as described on the README, you should have python 2.x installed on your system.

# It's been 7 years after 2.7 has been released, and pretty much the libraries listed
# are stabilized, so I don't expect to have trouble with versions.
# Maybe it happens some day... On someone's computer. That he doesn't have recent enough
# versions of these libraries.
pypy_src_url = 'https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.8.0-src'
pypy_src_dir = os.path.basename(pypy_src_url)

# If the untagged 'pypy' -directory is around, we will use that.
# But the pypy_src_url is still downloaded.

# These are listed in "Building PyPy from Source":
#                     http://doc.pypy.org/en/latest/build.html
command_depends = "pkg-config gcc make bzip2".split(' ')
library_depends = "libffi zlib sqlite3 ncurses expat libssl".split(' ')

def compile_lever(args):
    system = platform.system()
    if system == "Linux":
        zlib_abs = os.path.abspath("local/zlib")
        if os.path.exists(zlib_abs):
            insert_to_env("DEPENDENCY_LIBRARY_PATH", zlib_abs)
            insert_to_env("DEPENDENCY_INCLUDE_PATH", zlib_abs)

        libuv_abs = os.path.abspath("local/libuv")
        if os.path.exists(libuv_abs):
            linux_build_depedencies(libuv_is_local=True)
            insert_to_env("DEPENDENCY_LIBRARY_PATH", os.path.join(libuv_abs, "out/Release"))
            insert_to_env("DEPENDENCY_LIBRARY_PATH", os.path.join(libuv_abs, "out/Debug"))
            insert_to_env("DEPENDENCY_INCLUDE_PATH", os.path.join(libuv_abs, "include"))
        else:
            linux_build_depedencies(libuv_is_local=False)
    elif system == "Windows":
        zlib_abs = os.path.abspath("local/zlib")
        if os.path.exists(zlib_abs):
            insert_to_env("DEPENDENCY_LIBRARY_PATH", zlib_abs)
            insert_to_env("DEPENDENCY_INCLUDE_PATH", zlib_abs)

        libuv_abs = os.path.abspath("local/libuv")
        if os.path.exists(libuv_abs):
            insert_to_env('LIB',     os.path.join(libuv_abs, "out/Release"))
            insert_to_env('LIB',     os.path.join(libuv_abs, "out/Debug"))
            insert_to_env('INCLUDE', os.path.join(libuv_abs, "include"))

        windows_build_dependencies()

        #local_abs = os.path.abspath("local")
        #if os.path.exists(local_abs):
        #    insert_to_env('PATH',    os.path.join(local_abs, "bin"))
        #    insert_to_env('INCLUDE', os.path.join(local_abs, "include"))
        #    insert_to_env('LIB',     os.path.join(local_abs, "lib"))
    else:
        assert False, "no dependency fetching script for {}".format(system)
    if os.path.exists('pypy'):
        os.environ['PYTHONPATH'] = 'pypy'
    else:
        os.environ['PYTHONPATH'] = pypy_src_dir
    rpython_bin = os.path.join(pypy_src_dir, 'rpython', 'bin', 'rpython')

    build_flags = []
    if not args.nojit:
        build_flags.append('--translation-jit')
    build_flags.append('--gc=incminimark')
    build_flags.append('--opt=2')
    if args.lldebug:
        build_flags.append('--lldebug')
    # PyPy STM was tried once. The plans are to
    # pick it up when it improves.
    if args.stm:
        build_flags.append('--stm')
    if args.use_pypy:
        check_call(['pypy', rpython_bin] +
            build_flags + ["runtime/goal_standalone.py"])
    else:
        check_call(['python', rpython_bin] +
            build_flags + ["runtime/goal_standalone.py"])
    compile_libraries(preserve_cache=False)

# To handle dependencies, I'm adding them into the environment
# variables before compiling.
def insert_to_env(name, path, separator=os.pathsep):
    value = os.environ.get(name, '').strip()
    if value == "":
        os.environ[name] = path
    else:
        os.environ[name] = path + separator + value

# The 'libuv_is_local' here is a bit of a mess.
#
def linux_build_depedencies(libuv_is_local):
    devnull = open(os.devnull, 'w')
    for cmd in command_depends:
        if call([cmd, '--version'], stdout=devnull, stderr=devnull) != 0:
            return linux_troubleshoot(cmd)
    extra = []
    extra_apt = []
    if not libuv_is_local:
        extra.append("libuv")
        extra_apt.append("libuv1-dev")
    for dependency in library_depends + extra:
        if call(['pkg-config', '--exists', dependency]) != 0:
            return linux_troubleshoot(dependency, extra_apt)
    linux_download_and_extract(pypy_src_dir, pypy_src_url + '.tar.bz2')

# On windows, you're going to need Visual studio 9.0 and you need to
# know how to use it. (You might obtain it by checking for "visual studio for python 2.7")
# Having frequent releases start to seem relevant, so I may have to setup a build computer that
# automates it. Maybe some day...
def windows_build_dependencies():
    if not os.path.exists(pypy_src_dir):
        url = urlopen(pypy_src_url + '.zip')
        zipfile = ZipFile(StringIO(url.read()))
        zipfile.extractall()
        print("Note that building from source for windows isn't frequent.")

    #if os.path.exists("local/include"):
    #    stdint_msvc2008_path = "local/include/stdint-msvc2008.h"
    #    if not os.path.exists(stdint_msvc2008_path):
    #        print("stdint-msvc2008.h missing, downloading it.")
    #        url = urlopen("https://raw.githubusercontent.com/libuv/libuv/v1.x/include/stdint-msvc2008.h")
    #        with open(stdint_msvc2008_path, 'wb') as fd:
    #            fd.write(url.read())

compile_lib_desc = """This command compiles the scripts in the lib/

If this command has not been run successfully,
the lever runtime will exclaim that bytecode
compiler is stale or missing.

This command is automatically run along the compile.
"""

def compile_lib(args):
    compile_libraries(not args.all)

def compile_libraries(preserve_cache=True):
    from compiler import compile
    import traceback
    print("Compiling libraries for lever")
    for dirname, subdirs, files in os.walk("lib"):
        for name in files:
            if name.endswith(".lc"):
                lc_name = os.path.join(dirname, name)
                cb_name = re.sub(".lc$", ".lc.cb", lc_name)
                # Compiling the whole `lib/` is not needed during development.
                # Chances are it will take whole lot of time eventually.
                # Trouble-free parsing isn't free.
                if preserve_cache and (os.path.isfile(cb_name)
                        and os.path.getmtime(cb_name) >= os.path.getmtime(lc_name)):
                    continue
                try:
                    compile.compile_file(cb_name, lc_name)
                except Exception as e:
                    if not isinstance(e, KeyError):
                        traceback.print_exc()
                    print("{}:{}".format(lc_name, e))

stop_troubleshoot = False
def linux_troubleshoot(item, extra_apt=[]):
    global stop_troubleshoot
    if stop_troubleshoot:
        print("That did not solve the problem")
        sys.exit(1)
    stop_troubleshoot = True
    print("Dependencies to compile or run:")
    print(' '.join(command_depends + library_depends))
    print()
    print("{} is missing".format(item))
    if re.search("ubuntu|debian", platform.platform(), re.IGNORECASE):
        print("Ubuntu/debian detected, trying to install")
        check_call(['sudo', 'apt-get', 'install'] +
            "gcc make libffi-dev pkg-config libz-dev libbz2-dev".split(' ') +
            "libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libuv1 libuv1-dev".split(' ') +
            extra_apt)
        print("Re-attempt")
        main()
    else:
        sys.exit(1)

def linux_download_and_extract(target, archive):
    if not os.path.exists(target):
        if len(glob.glob(target + '.tar.bz2')) == 0:
            check_call(['wget', archive])
        check_call(["tar", "-xf", target + '.tar.bz2'])

def win32_dist(args):
    """
        This script creates a win32 distribution for lever
    """
    import shutil
    if not os.path.exists("lever.exe"):
        print("Need something to distribute first. Run setup.py compile on win32")
        sys.exit(1)
    mtime = os.path.getmtime("lever.exe")
# I do not want to release stale distribution.
    for root, dirs, fils in os.walk("evaluator"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    for root, dirs, fils in os.walk("space"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    for root, dirs, fils in os.walk("runtime"):
        for fil in fils:
            mtime = min(mtime, os.path.getmtime(os.path.join(root, fil)))
    if mtime > os.path.getmtime("lever.exe"):
        print("Stale executable, re-run setup.py compile on win32")
        sys.exit(1)
    VERSION = open("VERSION").read().strip()
    archive = 'lever-{}.zip'.format(VERSION)
    zf = zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED)
    def include(path, to=None):
        to = path if to is None else to
        assert not os.path.isabs(path)
        zf.write(path, os.path.join("lever", to))
    def include_dir(dirname):
        for root, dirs, fils in os.walk(dirname):
            for fil in fils:
                include(os.path.join(root, fil))
    def include_contents(dirname):
        for root, dirs, fils in os.walk(dirname):
            for fil in fils:
                path = os.path.join(root, fil)
                include(path, os.path.relpath(path, dirname))

    include("lever.exe")
    include("lever-0.8.0.grammar")
    include("VERSION")
    include_dir("app")
    include_dir("lib")
    include_dir("doc")

    include_dir("samples")
    include_dir("headers")
    include("LICENSE.md", "LICENSE.lever.txt")
    include_contents("win32_extras")

    zf.close()
    print os.path.abspath(archive)

def refresh_docs(args):
    assert check_call(["./lever", "tools/print_module_index.lc",
        'doc/source_index.json' ]) == 0
    update_html_docs(args)

def documentation_stub(args):
    if args.src:
        check_call(["./lever", "tools/print_stub.lc",
            "doc/source_index.json",
            "source", args.name])
    else:
        check_call(["./lever", "tools/print_stub.lc",
            "doc/source_index.json",
            "group", args.name])

def update_html_docs(args):
    """
        Updates the html docs at 'www/doc'. By default updates the 'latest'.
    """
    check_call(["./lever", "tools/update_html_docs.lc",
        'doc', 'www/doc/' + args.tag ])
    print '(as a reference for a maintainer) rsync -avz www/ name@dest:www'

if __name__=='__main__':
    main()
<|endoftext|>


<commit_before>from setuptools import setup, find_packages

setup(
    name='pyop',
    version='1.0.0',
    packages=find_packages('src'),
    package_dir={'': 'src'},
    url='https://github.com/its-dirg/pyop',
    license='Apache 2.0',
    author='Rebecka Gulliksson',
    author_email='rebecka.gulliksson@umu.se',
    description='OpenID Connect Provider (OP) library in Python.',
    install_requires=[
        'oic >= 0.8.5.0',
        'pymongo'
    ]
)
<commit_msg>Bump version: 1.0.0 → 1.0.1<commit_after>from setuptools import setup, find_packages

setup(
    name='pyop',
    version='1.0.1',
    packages=find_packages('src'),
    package_dir={'': 'src'},
    url='https://github.com/its-dirg/pyop',
    license='Apache 2.0',
    author='Rebecka Gulliksson',
    author_email='rebecka.gulliksson@umu.se',
    description='OpenID Connect Provider (OP) library in Python.',
    install_requires=[
        'oic >= 0.8.5.0',
        'pymongo'
    ]
)
<|endoftext|>


<commit_before><commit_msg>Add the port modification message classes and enum - Issue #17<commit_after>"""Modifications to the port from the controller"""

# System imports

# Third-party imports

# Local source tree imports
from common import header as of_header
from foundation import base
from foundation import basic_types

# Classes

class PortMod(base.GenericStruct):
    """
    Implements messages to modify the behavior of the physical port.

        :param header -- OpenFlow header
        :param port_no -- Physical port number
        :param hw_addr -- The hardware address is not configurable.
                          This is used to sanity-check the request,
                          so it must be the same as returned in an
                          ofp_phy_port struct
        :param config -- Bitmap of OFPPC_* flags
        :param mask -- Bitmap of OFPPC_* flags to be changed
        :param advertise -- Bitmap of "ofp_port_features"s
        :param pad -- Pad to 64-bits
    """
    header = of_header.OFPHeader()
    port_no = basic_types.UBInt16()
    hw_addr = basic_types.UBInt8Array(length=OFP_ETH_ALEN)
    config = basic_types.UBInt32()
    mask = basic_types.UBInt32()
    advertise = basic_types.UBInt32()
    pad = basic_types.UBInt8Array(length=4)

    def __init__(self, header=None, port_no=None, hw_addr=None, config=None,
                 mask=None, advertise=None, pad=None):

        self.header = of_header.OFPHeader()
        self.port_no = port_no
        self.hw_addr = hw_addr
        self.config = config
        self.mask = mask
        self.advertise = advertise
        self.pad = pad
<|endoftext|>