Project structure & tools (pytest, tox etc.)

pull/11/head
grossmj 11 years ago
parent c4ed47b2dc
commit c6152c9503

1
.gitignore vendored

@ -33,3 +33,4 @@ nosetests.xml
.mr.developer.cfg .mr.developer.cfg
.project .project
.pydevproject .pydevproject
.settings

@ -12,6 +12,10 @@ install:
script: "python setup.py test" script: "python setup.py test"
branches:
only:
- master
notifications: notifications:
email: false email: false
irc: irc:

@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
Gns3-server <one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2013 Jeremy Grossmann Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
Gns3-server Copyright (C) 2013 Jeremy Grossmann <program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -16,7 +16,36 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Python 2.6 and 2.7 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import gns3_server import sys
import tornado.ioloop
import tornado.web
import gns3server
from datetime import date
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Ready to serve")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
print("GNS3 server version {0}".format(gns3server.__version__))
print("Copyright (c) 2007-{0} GNS3 Technologies Inc.".format(date.today().year))
if sys.version_info < (2, 6):
raise RuntimeError("Python 2.6 or higher is required")
elif sys.version_info[0] == 3 and sys.version_info < (3, 3):
raise RuntimeError("Python 3.3 or higher is required")
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
print(gns3_server.__version__)

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# #
# Copyright (C) 2013 GNS3 Technologies Inc. # Copyright (C) 2013 GNS3 Technologies Inc.

@ -0,0 +1,31 @@
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
PY2 = sys.version_info[0] == 2
if not PY2:
unichr = chr
range_type = range
text_type = str
string_types = (str,)
else:
unichr = unichr
text_type = unicode
range_type = xrange
string_types = (str, unicode)

@ -0,0 +1,5 @@
Yapsy==1.10.2-pythons2n3
astroid==1.0.0
logilab-common==0.60.0
networkx==1.8.1
tornado==3.1.1

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
# #
# Copyright (C) 2013 GNS3 Technologies Inc. # Copyright (C) 2013 GNS3 Technologies Inc.
@ -18,10 +17,10 @@
import sys import sys
import os import os
from setuptools import setup from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand from setuptools.command.test import test as TestCommand
import gns3_server import gns3server
class Tox(TestCommand): class Tox(TestCommand):
def finalize_options(self): def finalize_options(self):
@ -37,7 +36,7 @@ class Tox(TestCommand):
setup( setup(
name = 'gns3-server', name = 'gns3-server',
scripts = ['gns3-server.py'], scripts = ['gns3-server.py'],
version = gns3_server.__version__, version = gns3server.__version__,
url = 'http://github.com/GNS3/gns3-server', url = 'http://github.com/GNS3/gns3-server',
license = 'GNU General Public License v3 (GPLv3)', license = 'GNU General Public License v3 (GPLv3)',
tests_require = ['tox'], tests_require = ['tox'],
@ -47,7 +46,7 @@ setup(
author_email = 'package-maintainer@gns3.net', author_email = 'package-maintainer@gns3.net',
description = 'GNS3 server with HTTP REST API to manage emulators', description = 'GNS3 server with HTTP REST API to manage emulators',
long_description = open('README.rst', 'r').read(), long_description = open('README.rst', 'r').read(),
packages = ['gns3_server'], packages = find_packages(),
include_package_data = True, include_package_data = True,
platforms = 'any', platforms = 'any',
classifiers = [ classifiers = [

@ -2,5 +2,5 @@
envlist = py26, py27, pypy, py33 envlist = py26, py27, pypy, py33
[testenv] [testenv]
deps = nose deps = pytest
commands = nosetests commands = py.test

Loading…
Cancel
Save