1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 00:08:11 +00:00

Project structure & tools (pytest, tox etc.)

This commit is contained in:
grossmj 2013-10-08 11:33:51 -06:00
parent c4ed47b2dc
commit c6152c9503
10 changed files with 82 additions and 14 deletions

1
.gitignore vendored
View File

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

View File

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

View File

@ -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
the "copyright" line and a pointer to where the full notice is found.
Gns3-server
Copyright (C) 2013 Jeremy Grossmann
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
@ -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
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 is free software, and you are welcome to redistribute it
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
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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -16,7 +16,36 @@
# You should have received a copy of the GNU General Public License
# 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__)

View File

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

31
gns3server/_compat.py Normal file
View File

@ -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)

View File

@ -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

View File

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

View File

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