2014-06-10 08:50:45 -05:00
#!/usr/bin/env python
2014-06-02 20:44:54 -05:00
# Copyright (C) 2014 Srivats P.
#
# This file is part of "Ostinato"
#
# This 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/>
2014-06-07 09:42:51 -05:00
import json
2014-06-02 20:44:54 -05:00
import os
import shutil
import sys
2014-06-08 08:40:49 -05:00
from setuptools import Command , setup
from setuptools . command . sdist import sdist as _sdist
2014-06-02 20:44:54 -05:00
def read ( fname ) :
2014-06-08 08:40:49 -05:00
return open ( os . path . join ( os . path . dirname ( __file__ ) , fname ) ) . read ( )
2014-06-02 20:44:54 -05:00
2014-06-08 08:40:49 -05:00
def ensure_cwd ( ) :
2014-06-07 09:42:51 -05:00
if os . path . split ( os . getcwd ( ) ) [ 1 ] != ' binding ' :
2014-06-14 06:32:40 -05:00
print ( ' ERROR: This script needs to be run from the binding directory ' )
print ( ' Current Working Directory is %s ' % os . getcwd ( ) )
2014-06-07 09:42:51 -05:00
sys . exit ( 1 )
2014-06-08 08:40:49 -05:00
class sdist ( _sdist ) :
def run ( self ) :
ensure_cwd ( )
_sdist . run ( self )
class sdist_clean ( Command ) :
description = ' clean stuff generated by sdist '
user_options = [ ]
def initialize_options ( self ) :
return
def finalize_options ( self ) :
return
def run ( self ) :
ensure_cwd ( )
shutil . rmtree ( ' dist ' , ignore_errors = True )
2014-06-14 06:32:40 -05:00
shutil . rmtree ( ' python-ostinato.egg-info ' , ignore_errors = True )
shutil . rmtree ( ' python_ostinato.egg-info ' , ignore_errors = True )
2014-06-08 08:40:49 -05:00
# ------- script starts from here ------- #
with open ( os . path . join ( os . path . dirname ( __file__ ) , ' pkg_info.json ' ) ) as f :
pkg_info = json . load ( f )
2014-06-07 09:42:51 -05:00
2014-06-14 06:32:40 -05:00
setup ( name = ' python-ostinato ' ,
2014-06-07 09:42:51 -05:00
version = pkg_info [ ' version ' ] ,
2014-06-02 20:44:54 -05:00
author = ' Srivats P ' ,
author_email = ' pstavirs@gmail.com ' ,
license = " GPLv3+ " ,
url = ' http://ostinato.org ' ,
description = ' Ostinato is a network packet and traffic generator and analyzer. It aims to be " Wireshark in Reverse " and become complementary to Wireshark. It features custom packet crafting via a GUI or a script ' ,
long_description = read ( ' README.txt ' ) ,
2014-06-07 09:42:51 -05:00
install_requires = [ ' protobuf>=2.3.0 ' ] ,
packages = [ ' ostinato ' , ' ostinato.protocols ' ] ,
package_dir = { ' ostinato ' : ' . ' } ,
2014-06-10 08:50:45 -05:00
package_data = { ' ostinato ' : [ ' pkg_info.json ' , ' LICENSE.txt ' ] } ,
2014-06-07 10:28:50 -05:00
platforms = [ ' Any ' ] ,
classifiers = [
2014-06-14 06:32:40 -05:00
' Development Status :: 4 - Beta ' ,
' Programming Language :: Python :: 2.7 ' ,
2014-06-07 10:28:50 -05:00
' Intended Audience :: Telecommunications Industry ' ,
' License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) ' ,
' Topic :: Software Development :: Testing :: Traffic Generation ' ,
2014-06-08 08:40:49 -05:00
' Topic :: System :: Networking ' ] ,
cmdclass = {
' sdist ' : sdist ,
' sdist_clean ' : sdist_clean } ,
2014-06-02 20:44:54 -05:00
)
2014-06-07 09:42:51 -05:00