Updated python packaging
This commit is contained in:
parent
13ff09f421
commit
d3b9d9be83
@ -0,0 +1,7 @@
|
|||||||
|
========
|
||||||
|
Ostinato
|
||||||
|
========
|
||||||
|
|
||||||
|
Ostinato provides a scripting interface to the Ostinato Packet/Traffic Generator and Analyzer
|
||||||
|
|
||||||
|
Documentation is available in the wiki at http://ostinato.org
|
@ -15,3 +15,12 @@
|
|||||||
# 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/>
|
||||||
|
|
||||||
|
import json
|
||||||
|
from os.path import dirname
|
||||||
|
|
||||||
|
with open(dirname(__file__) + '/pkg_info.json') as f:
|
||||||
|
_info = json.load(f)
|
||||||
|
|
||||||
|
__version__ = _info['version']
|
||||||
|
__revision__ = _info['revision']
|
||||||
|
|
||||||
|
@ -15,28 +15,56 @@
|
|||||||
# 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/>
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
def read(fname):
|
def read(fname):
|
||||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
return open(fname).read()
|
||||||
|
|
||||||
if sys.argv[1] == 'clean_sdist':
|
def get_pkg_info():
|
||||||
|
info = {}
|
||||||
|
t = open('../server/version.cpp').read()
|
||||||
|
info['version'] = re.search('version = "([^"]*)"', t).group(1)
|
||||||
|
info['revision'] = re.search('revision = "([^"]*)"', t).group(1)
|
||||||
|
return info
|
||||||
|
|
||||||
|
# ------- script starts from here ------- #
|
||||||
|
|
||||||
|
if len(sys.argv) >= 2 and sys.argv[1] == 'clean_sdist':
|
||||||
shutil.rmtree('dist', ignore_errors = True)
|
shutil.rmtree('dist', ignore_errors = True)
|
||||||
shutil.rmtree('ostinato.egg-info', ignore_errors = True)
|
shutil.rmtree('ostinato.egg-info', ignore_errors = True)
|
||||||
|
if os.path.exists('pkg_info.json'):
|
||||||
|
os.remove('pkg_info.json')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if len(sys.argv) >= 2 and sys.argv[1] == 'sdist':
|
||||||
|
if os.path.split(os.getcwd())[1] != 'binding':
|
||||||
|
print 'This script needs to be run from the binding directory'
|
||||||
|
print 'Current Working Directory is %s' % os.getcwd()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
pkg_info = get_pkg_info()
|
||||||
|
with open('pkg_info.json', 'wt') as f:
|
||||||
|
json.dump(pkg_info, f, indent=4)
|
||||||
|
else:
|
||||||
|
with open('pkg_info.json') as f:
|
||||||
|
pkg_info = json.load(f)
|
||||||
|
|
||||||
setup(name = 'ostinato',
|
setup(name = 'ostinato',
|
||||||
version = 'FIXME',
|
version = pkg_info['version'],
|
||||||
author = 'Srivats P',
|
author = 'Srivats P',
|
||||||
author_email = 'pstavirs@gmail.com',
|
author_email = 'pstavirs@gmail.com',
|
||||||
license = "GPLv3+",
|
license = "GPLv3+",
|
||||||
url = 'http://ostinato.org',
|
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',
|
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'),
|
long_description = read('README.txt'),
|
||||||
install_requires = ['google.protobuf>=2.3'],
|
install_requires = ['protobuf>=2.3.0'],
|
||||||
packages=['ostinato', 'ostinato.protocols'],
|
packages = ['ostinato', 'ostinato.protocols'],
|
||||||
package_dir={'ostinato': ''}
|
package_dir = {'ostinato': '.'},
|
||||||
|
package_data = {'ostinato': ['pkg_info.json']},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user