From deeb9c4852c699ad26a5d81cdf13176cb6c2e114 Mon Sep 17 00:00:00 2001 From: k clair Date: Tue, 9 Oct 2012 12:55:01 -0700 Subject: add previously generated debian packaging files --- ping-0.2/debian/README.Debian | 6 + ping-0.2/debian/README.source | 9 + ping-0.2/debian/changelog | 5 + ping-0.2/debian/compat | 1 + ping-0.2/debian/control | 23 ++ ping-0.2/debian/copyright | 42 +++ ping-0.2/debian/docs | 1 + ping-0.2/debian/emacsen-install.ex | 45 ++++ ping-0.2/debian/emacsen-remove.ex | 15 ++ ping-0.2/debian/emacsen-startup.ex | 25 ++ ping-0.2/debian/files | 1 + ping-0.2/debian/init.d.ex | 154 +++++++++++ ping-0.2/debian/manpage.1.ex | 59 +++++ ping-0.2/debian/manpage.sgml.ex | 154 +++++++++++ ping-0.2/debian/manpage.xml.ex | 291 +++++++++++++++++++++ ping-0.2/debian/menu.ex | 2 + ping-0.2/debian/postinst.ex | 39 +++ ping-0.2/debian/postrm.ex | 37 +++ ping-0.2/debian/preinst.ex | 35 +++ ping-0.2/debian/prerm.ex | 38 +++ ping-0.2/debian/python-ping.cron.d.ex | 4 + ping-0.2/debian/python-ping.debhelper.log | 45 ++++ ping-0.2/debian/python-ping.default.ex | 10 + ping-0.2/debian/python-ping.doc-base.EX | 20 ++ ping-0.2/debian/python-ping.postinst.debhelper | 5 + ping-0.2/debian/python-ping.prerm.debhelper | 5 + ping-0.2/debian/python-ping.substvars | 4 + ping-0.2/debian/python-ping/DEBIAN/control | 20 ++ ping-0.2/debian/python-ping/DEBIAN/md5sums | 7 + ping-0.2/debian/python-ping/DEBIAN/postinst | 7 + ping-0.2/debian/python-ping/DEBIAN/prerm | 7 + .../python-ping/usr/share/doc/python-ping/README | 9 + .../usr/share/doc/python-ping/README.Debian | 6 + .../usr/share/doc/python-ping/changelog.Debian.gz | Bin 0 -> 176 bytes .../usr/share/doc/python-ping/copyright | 42 +++ .../usr/share/pyshared/ping-0.2.egg-info | 31 +++ .../debian/python-ping/usr/share/pyshared/ping.py | 273 +++++++++++++++++++ .../usr/share/python-support/python-ping.public | 2 + ping-0.2/debian/rules | 13 + ping-0.2/debian/source/format | 1 + ping-0.2/debian/watch.ex | 23 ++ 41 files changed, 1516 insertions(+) create mode 100644 ping-0.2/debian/README.Debian create mode 100644 ping-0.2/debian/README.source create mode 100644 ping-0.2/debian/changelog create mode 100644 ping-0.2/debian/compat create mode 100644 ping-0.2/debian/control create mode 100644 ping-0.2/debian/copyright create mode 100644 ping-0.2/debian/docs create mode 100644 ping-0.2/debian/emacsen-install.ex create mode 100644 ping-0.2/debian/emacsen-remove.ex create mode 100644 ping-0.2/debian/emacsen-startup.ex create mode 100644 ping-0.2/debian/files create mode 100644 ping-0.2/debian/init.d.ex create mode 100644 ping-0.2/debian/manpage.1.ex create mode 100644 ping-0.2/debian/manpage.sgml.ex create mode 100644 ping-0.2/debian/manpage.xml.ex create mode 100644 ping-0.2/debian/menu.ex create mode 100644 ping-0.2/debian/postinst.ex create mode 100644 ping-0.2/debian/postrm.ex create mode 100644 ping-0.2/debian/preinst.ex create mode 100644 ping-0.2/debian/prerm.ex create mode 100644 ping-0.2/debian/python-ping.cron.d.ex create mode 100644 ping-0.2/debian/python-ping.debhelper.log create mode 100644 ping-0.2/debian/python-ping.default.ex create mode 100644 ping-0.2/debian/python-ping.doc-base.EX create mode 100644 ping-0.2/debian/python-ping.postinst.debhelper create mode 100644 ping-0.2/debian/python-ping.prerm.debhelper create mode 100644 ping-0.2/debian/python-ping.substvars create mode 100644 ping-0.2/debian/python-ping/DEBIAN/control create mode 100644 ping-0.2/debian/python-ping/DEBIAN/md5sums create mode 100755 ping-0.2/debian/python-ping/DEBIAN/postinst create mode 100755 ping-0.2/debian/python-ping/DEBIAN/prerm create mode 100644 ping-0.2/debian/python-ping/usr/share/doc/python-ping/README create mode 100644 ping-0.2/debian/python-ping/usr/share/doc/python-ping/README.Debian create mode 100644 ping-0.2/debian/python-ping/usr/share/doc/python-ping/changelog.Debian.gz create mode 100644 ping-0.2/debian/python-ping/usr/share/doc/python-ping/copyright create mode 100644 ping-0.2/debian/python-ping/usr/share/pyshared/ping-0.2.egg-info create mode 100644 ping-0.2/debian/python-ping/usr/share/pyshared/ping.py create mode 100644 ping-0.2/debian/python-ping/usr/share/python-support/python-ping.public create mode 100755 ping-0.2/debian/rules create mode 100644 ping-0.2/debian/source/format create mode 100644 ping-0.2/debian/watch.ex (limited to 'ping-0.2/debian') diff --git a/ping-0.2/debian/README.Debian b/ping-0.2/debian/README.Debian new file mode 100644 index 0000000..59e8175 --- /dev/null +++ b/ping-0.2/debian/README.Debian @@ -0,0 +1,6 @@ +python-ping for Debian +---------------------- + + + + -- Kristina Clair Wed, 03 Oct 2012 11:59:08 -0700 diff --git a/ping-0.2/debian/README.source b/ping-0.2/debian/README.source new file mode 100644 index 0000000..0be4803 --- /dev/null +++ b/ping-0.2/debian/README.source @@ -0,0 +1,9 @@ +python-ping for Debian +---------------------- + + + + + + diff --git a/ping-0.2/debian/changelog b/ping-0.2/debian/changelog new file mode 100644 index 0000000..156db40 --- /dev/null +++ b/ping-0.2/debian/changelog @@ -0,0 +1,5 @@ +python-ping (0.2-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- Kristina Clair Wed, 03 Oct 2012 11:59:08 -0700 diff --git a/ping-0.2/debian/compat b/ping-0.2/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/ping-0.2/debian/compat @@ -0,0 +1 @@ +7 diff --git a/ping-0.2/debian/control b/ping-0.2/debian/control new file mode 100644 index 0000000..48c946b --- /dev/null +++ b/ping-0.2/debian/control @@ -0,0 +1,23 @@ +Source: python-ping +Maintainer: Kristina Clair +Section: python +Priority: optional +Build-Depends: debhelper (>= 7), python-support (>= 0.8.4) +Standards-Version: 3.8.4 + +Package: python-ping +Architecture: all +Depends: ${misc:Depends}, ${python:Depends} +XB-Python-Version: ${python:Versions} +Provides: ${python:Provides} +Description: An implementation of ICMP ping in Python + This library is a fork of George Notaras' python-ping library, which is + an implementation of the standard ICMP ping in pure Python. + . + As it uses raw ICMP sockets, you need to be root to use the functions + exported by the ping module. + . + This fork by Pierre Bourdon adds a setup.py file in order to permit an + easier distribution of the package. The license of the library remains + unchanged (GPLv2), see COPYING. + . diff --git a/ping-0.2/debian/copyright b/ping-0.2/debian/copyright new file mode 100644 index 0000000..a979dc1 --- /dev/null +++ b/ping-0.2/debian/copyright @@ -0,0 +1,42 @@ +This work was packaged for Debian by: + + Kristina Clair on Wed, 03 Oct 2012 11:45:53 -0700 + +It was downloaded from: + + http://pypi.python.org/pypi/ping/ + +Upstream Author(s): + + Pierre Bourdon + Georgi Kolev + +Copyright: + + Copyright (C) Pierre Bourdon + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This package 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 + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +The Debian packaging is: + + Copyright (C) 2012 Kristina Clair + + 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 2 of the License, or + (at your option) any later version. diff --git a/ping-0.2/debian/docs b/ping-0.2/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/ping-0.2/debian/docs @@ -0,0 +1 @@ +README diff --git a/ping-0.2/debian/emacsen-install.ex b/ping-0.2/debian/emacsen-install.ex new file mode 100644 index 0000000..5e9eec8 --- /dev/null +++ b/ping-0.2/debian/emacsen-install.ex @@ -0,0 +1,45 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/python-ping + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . + +FLAVOR=$1 +PACKAGE=python-ping + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +#FLAVORTEST=`echo $FLAVOR | cut -c-6` +#if [ ${FLAVORTEST} = xemacs ] ; then +# SITEFLAG="-no-site-file" +#else +# SITEFLAG="--no-site-file" +#fi +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cp ${FILES} ${ELCDIR} +cd ${ELCDIR} + +cat << EOF > path.el +(setq load-path (cons "." load-path) byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f *.el path.el + +exit 0 diff --git a/ping-0.2/debian/emacsen-remove.ex b/ping-0.2/debian/emacsen-remove.ex new file mode 100644 index 0000000..ff854d0 --- /dev/null +++ b/ping-0.2/debian/emacsen-remove.ex @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/python-ping + +FLAVOR=$1 +PACKAGE=python-ping + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/python-ping.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff --git a/ping-0.2/debian/emacsen-startup.ex b/ping-0.2/debian/emacsen-startup.ex new file mode 100644 index 0000000..eeb713c --- /dev/null +++ b/ping-0.2/debian/emacsen-startup.ex @@ -0,0 +1,25 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file, e.g. /etc/emacs/site-start.d/50python-ping.el +;; for the Debian python-ping package +;; +;; Originally contributed by Nils Naumann +;; Modified by Dirk Eddelbuettel +;; Adapted for dh-make by Jim Van Zandt + +;; The python-ping package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name flavor) + "/site-lisp/python-ping"))) +;; If package-dir does not exist, the python-ping package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (setq load-path (cons package-dir load-path)) + (autoload 'python-ping-mode "python-ping-mode" + "Major mode for editing python-ping files." t) + (add-to-list 'auto-mode-alist '("\\.python-ping$" . python-ping-mode)))) + diff --git a/ping-0.2/debian/files b/ping-0.2/debian/files new file mode 100644 index 0000000..8529412 --- /dev/null +++ b/ping-0.2/debian/files @@ -0,0 +1 @@ +python-ping_0.2-1_all.deb python optional diff --git a/ping-0.2/debian/init.d.ex b/ping-0.2/debian/init.d.ex new file mode 100644 index 0000000..6f77eba --- /dev/null +++ b/ping-0.2/debian/init.d.ex @@ -0,0 +1,154 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: python-ping +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: Kristina Clair + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=python-ping # Introduce a short description here +NAME=python-ping # Introduce the short server's name here +DAEMON=/usr/sbin/python-ping # Introduce the server's location here +DAEMON_ARGS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/ping-0.2/debian/manpage.1.ex b/ping-0.2/debian/manpage.1.ex new file mode 100644 index 0000000..a5a91fa --- /dev/null +++ b/ping-0.2/debian/manpage.1.ex @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH PYTHON-PING SECTION "October 3, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +python-ping \- program to do something +.SH SYNOPSIS +.B python-ping +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B python-ping +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBpython-ping\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +python-ping was written by . +.PP +This manual page was written by Kristina Clair , +for the Debian project (and may be used by others). diff --git a/ping-0.2/debian/manpage.sgml.ex b/ping-0.2/debian/manpage.sgml.ex new file mode 100644 index 0000000..e13bc35 --- /dev/null +++ b/ping-0.2/debian/manpage.sgml.ex @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + October 3, 2012"> + + SECTION"> + kclair@leap.se"> + + PYTHON-PING"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff --git a/ping-0.2/debian/manpage.xml.ex b/ping-0.2/debian/manpage.xml.ex new file mode 100644 index 0000000..8d8cc6d --- /dev/null +++ b/ping-0.2/debian/manpage.xml.ex @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff --git a/ping-0.2/debian/menu.ex b/ping-0.2/debian/menu.ex new file mode 100644 index 0000000..3820e61 --- /dev/null +++ b/ping-0.2/debian/menu.ex @@ -0,0 +1,2 @@ +?package(python-ping):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\ + title="python-ping" command="/usr/bin/python-ping" diff --git a/ping-0.2/debian/postinst.ex b/ping-0.2/debian/postinst.ex new file mode 100644 index 0000000..3bcfde3 --- /dev/null +++ b/ping-0.2/debian/postinst.ex @@ -0,0 +1,39 @@ +#!/bin/sh +# postinst script for python-ping +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/ping-0.2/debian/postrm.ex b/ping-0.2/debian/postrm.ex new file mode 100644 index 0000000..6a4d8e8 --- /dev/null +++ b/ping-0.2/debian/postrm.ex @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for python-ping +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/ping-0.2/debian/preinst.ex b/ping-0.2/debian/preinst.ex new file mode 100644 index 0000000..6b6daa5 --- /dev/null +++ b/ping-0.2/debian/preinst.ex @@ -0,0 +1,35 @@ +#!/bin/sh +# preinst script for python-ping +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/ping-0.2/debian/prerm.ex b/ping-0.2/debian/prerm.ex new file mode 100644 index 0000000..d397c4c --- /dev/null +++ b/ping-0.2/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for python-ping +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/ping-0.2/debian/python-ping.cron.d.ex b/ping-0.2/debian/python-ping.cron.d.ex new file mode 100644 index 0000000..1cd8ea1 --- /dev/null +++ b/ping-0.2/debian/python-ping.cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the python-ping package +# +0 4 * * * root [ -x /usr/bin/python-ping_maintenance ] && /usr/bin/python-ping_maintenance diff --git a/ping-0.2/debian/python-ping.debhelper.log b/ping-0.2/debian/python-ping.debhelper.log new file mode 100644 index 0000000..2d06fcd --- /dev/null +++ b/ping-0.2/debian/python-ping.debhelper.log @@ -0,0 +1,45 @@ +dh_auto_configure +dh_auto_build +dh_auto_test +dh_prep +dh_installdirs +dh_auto_install +dh_install +dh_installdocs +dh_installchangelogs +dh_installexamples +dh_installman +dh_installcatalogs +dh_installcron +dh_installdebconf +dh_installemacsen +dh_installifupdown +dh_installinfo +dh_pysupport +dh_installinit +dh_installmenu +dh_installmime +dh_installmodules +dh_installlogcheck +dh_installlogrotate +dh_installpam +dh_installppp +dh_installudev +dh_installwm +dh_installxfonts +dh_bugfiles +dh_lintian +dh_gconf +dh_icons +dh_perl +dh_usrlocal +dh_link +dh_compress +dh_fixperms +dh_strip +dh_makeshlibs +dh_shlibdeps +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb diff --git a/ping-0.2/debian/python-ping.default.ex b/ping-0.2/debian/python-ping.default.ex new file mode 100644 index 0000000..d63db49 --- /dev/null +++ b/ping-0.2/debian/python-ping.default.ex @@ -0,0 +1,10 @@ +# Defaults for python-ping initscript +# sourced by /etc/init.d/python-ping +# installed at /etc/default/python-ping by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="" diff --git a/ping-0.2/debian/python-ping.doc-base.EX b/ping-0.2/debian/python-ping.doc-base.EX new file mode 100644 index 0000000..6478de5 --- /dev/null +++ b/ping-0.2/debian/python-ping.doc-base.EX @@ -0,0 +1,20 @@ +Document: python-ping +Title: Debian python-ping Manual +Author: +Abstract: This manual describes what python-ping is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/python-ping/python-ping.sgml.gz + +Format: postscript +Files: /usr/share/doc/python-ping/python-ping.ps.gz + +Format: text +Files: /usr/share/doc/python-ping/python-ping.text.gz + +Format: HTML +Index: /usr/share/doc/python-ping/html/index.html +Files: /usr/share/doc/python-ping/html/*.html diff --git a/ping-0.2/debian/python-ping.postinst.debhelper b/ping-0.2/debian/python-ping.postinst.debhelper new file mode 100644 index 0000000..47b9418 --- /dev/null +++ b/ping-0.2/debian/python-ping.postinst.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_pysupport +if which update-python-modules >/dev/null 2>&1; then + update-python-modules python-ping.public +fi +# End automatically added section diff --git a/ping-0.2/debian/python-ping.prerm.debhelper b/ping-0.2/debian/python-ping.prerm.debhelper new file mode 100644 index 0000000..431bd96 --- /dev/null +++ b/ping-0.2/debian/python-ping.prerm.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_pysupport +if which update-python-modules >/dev/null 2>&1; then + update-python-modules -c python-ping.public +fi +# End automatically added section diff --git a/ping-0.2/debian/python-ping.substvars b/ping-0.2/debian/python-ping.substvars new file mode 100644 index 0000000..7c033c4 --- /dev/null +++ b/ping-0.2/debian/python-ping.substvars @@ -0,0 +1,4 @@ +python:Versions=2.5, 2.6 +python:Provides=python2.5-ping, python2.6-ping +python:Depends=python, python-support (>= 0.90.0) +misc:Depends= diff --git a/ping-0.2/debian/python-ping/DEBIAN/control b/ping-0.2/debian/python-ping/DEBIAN/control new file mode 100644 index 0000000..b97ec21 --- /dev/null +++ b/ping-0.2/debian/python-ping/DEBIAN/control @@ -0,0 +1,20 @@ +Package: python-ping +Version: 0.2-1 +Architecture: all +Maintainer: Kristina Clair +Installed-Size: 76 +Depends: python, python-support (>= 0.90.0) +Provides: python2.5-ping, python2.6-ping +Section: python +Priority: optional +Description: An implementation of ICMP ping in Python + This library is a fork of George Notaras' python-ping library, which is + an implementation of the standard ICMP ping in pure Python. + . + As it uses raw ICMP sockets, you need to be root to use the functions + exported by the ping module. + . + This fork by Pierre Bourdon adds a setup.py file in order to permit an + easier distribution of the package. The license of the library remains + unchanged (GPLv2), see COPYING. +Python-Version: 2.5, 2.6 diff --git a/ping-0.2/debian/python-ping/DEBIAN/md5sums b/ping-0.2/debian/python-ping/DEBIAN/md5sums new file mode 100644 index 0000000..21aca8b --- /dev/null +++ b/ping-0.2/debian/python-ping/DEBIAN/md5sums @@ -0,0 +1,7 @@ +0851268cfa5f0ed91ecddae6d42e10c4 usr/share/doc/python-ping/README +218257068617a420552b25445a495b01 usr/share/doc/python-ping/README.Debian +9de4874a2f489523a5128c8255aa2457 usr/share/doc/python-ping/changelog.Debian.gz +27543d7b5ce6a9f6319cff1d1d5a7a0b usr/share/doc/python-ping/copyright +b246e4f2dcf66e20c6353b89c3df912a usr/share/pyshared/ping-0.2.egg-info +b9da1875bfb3013c16f66ed22edaa46f usr/share/pyshared/ping.py +4f51c996bcf5086cb0de223b62a146eb usr/share/python-support/python-ping.public diff --git a/ping-0.2/debian/python-ping/DEBIAN/postinst b/ping-0.2/debian/python-ping/DEBIAN/postinst new file mode 100755 index 0000000..6aa6c16 --- /dev/null +++ b/ping-0.2/debian/python-ping/DEBIAN/postinst @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_pysupport +if which update-python-modules >/dev/null 2>&1; then + update-python-modules python-ping.public +fi +# End automatically added section diff --git a/ping-0.2/debian/python-ping/DEBIAN/prerm b/ping-0.2/debian/python-ping/DEBIAN/prerm new file mode 100755 index 0000000..99c6b3b --- /dev/null +++ b/ping-0.2/debian/python-ping/DEBIAN/prerm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_pysupport +if which update-python-modules >/dev/null 2>&1; then + update-python-modules -c python-ping.public +fi +# End automatically added section diff --git a/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README new file mode 100644 index 0000000..b3cccd7 --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README @@ -0,0 +1,9 @@ +This library is a fork of George Notaras' python-ping library, which is +an implementation of the standard ICMP ping in pure Python. + +As it uses raw ICMP sockets, you need to be root to use the functions +exported by the ping module. + +This fork by Pierre Bourdon adds a setup.py file in order to permit an +easier distribution of the package. The license of the library remains +unchanged (GPLv2), see COPYING. diff --git a/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README.Debian b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README.Debian new file mode 100644 index 0000000..59e8175 --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/README.Debian @@ -0,0 +1,6 @@ +python-ping for Debian +---------------------- + + + + -- Kristina Clair Wed, 03 Oct 2012 11:59:08 -0700 diff --git a/ping-0.2/debian/python-ping/usr/share/doc/python-ping/changelog.Debian.gz b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/changelog.Debian.gz new file mode 100644 index 0000000..5e6b245 Binary files /dev/null and b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/changelog.Debian.gz differ diff --git a/ping-0.2/debian/python-ping/usr/share/doc/python-ping/copyright b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/copyright new file mode 100644 index 0000000..a979dc1 --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/doc/python-ping/copyright @@ -0,0 +1,42 @@ +This work was packaged for Debian by: + + Kristina Clair on Wed, 03 Oct 2012 11:45:53 -0700 + +It was downloaded from: + + http://pypi.python.org/pypi/ping/ + +Upstream Author(s): + + Pierre Bourdon + Georgi Kolev + +Copyright: + + Copyright (C) Pierre Bourdon + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This package 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 + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +The Debian packaging is: + + Copyright (C) 2012 Kristina Clair + + 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 2 of the License, or + (at your option) any later version. diff --git a/ping-0.2/debian/python-ping/usr/share/pyshared/ping-0.2.egg-info b/ping-0.2/debian/python-ping/usr/share/pyshared/ping-0.2.egg-info new file mode 100644 index 0000000..bdcd4f1 --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/pyshared/ping-0.2.egg-info @@ -0,0 +1,31 @@ +Metadata-Version: 1.0 +Name: ping +Version: 0.2 +Summary: An implementation of ICMP ping in Python +Home-page: http://bitbucket.org/delroth/python-ping/ +Author: Pierre Bourdon +Author-email: delroth@gmail.com +License: GPL2 +Download-URL: http://bitbucket.org/delroth/python-ping/downloads/python-ping-0.2.tar.gz +Description: This library is a fork of George Notaras' python-ping library, which is + an implementation of the standard ICMP ping in pure Python. + + As it uses raw ICMP sockets, you need to be root to use the functions + exported by the ping module. + + This fork by Pierre Bourdon adds a setup.py file in order to permit an + easier distribution of the package. The license of the library remains + unchanged (GPLv2), see COPYING. + +Keywords: ping icmp network latency +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: System Administrators +Classifier: License :: OSI Approved :: GNU General Public License (GPL) +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python :: 2 +Classifier: Topic :: Internet +Classifier: Topic :: System :: Networking +Classifier: Topic :: System :: Networking :: Monitoring diff --git a/ping-0.2/debian/python-ping/usr/share/pyshared/ping.py b/ping-0.2/debian/python-ping/usr/share/pyshared/ping.py new file mode 100644 index 0000000..8c4a4bd --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/pyshared/ping.py @@ -0,0 +1,273 @@ +#!/usr/bin/env python + +""" + A pure python ping implementation using raw socket. + + + Note that ICMP messages can only be sent from processes running as root. + + + Derived from ping.c distributed in Linux's netkit. That code is + copyright (c) 1989 by The Regents of the University of California. + That code is in turn derived from code written by Mike Muuss of the + US Army Ballistic Research Laboratory in December, 1983 and + placed in the public domain. They have my thanks. + + Bugs are naturally mine. I'd be glad to hear about them. There are + certainly word - size dependenceies here. + + Copyright (c) Matthew Dixon Cowles, . + Distributable under the terms of the GNU General Public License + version 2. Provided with no warranties of any sort. + + Original Version from Matthew Dixon Cowles: + -> ftp://ftp.visi.com/users/mdc/ping.py + + Rewrite by Jens Diemer: + -> http://www.python-forum.de/post-69122.html#69122 + + Rewrite by George Notaras: + -> http://www.g-loaded.eu/2009/10/30/python-ping/ + + Fork by Pierre Bourdon: + -> http://bitbucket.org/delroth/python-ping/ + + Revision history + ~~~~~~~~~~~~~~~~ + + November 22, 1997 + ----------------- + Initial hack. Doesn't do much, but rather than try to guess + what features I (or others) will want in the future, I've only + put in what I need now. + + December 16, 1997 + ----------------- + For some reason, the checksum bytes are in the wrong order when + this is run under Solaris 2.X for SPARC but it works right under + Linux x86. Since I don't know just what's wrong, I'll swap the + bytes always and then do an htons(). + + December 4, 2000 + ---------------- + Changed the struct.pack() calls to pack the checksum and ID as + unsigned. My thanks to Jerome Poincheval for the fix. + + May 30, 2007 + ------------ + little rewrite by Jens Diemer: + - change socket asterisk import to a normal import + - replace time.time() with time.clock() + - delete "return None" (or change to "return" only) + - in checksum() rename "str" to "source_string" + + November 8, 2009 + ---------------- + Improved compatibility with GNU/Linux systems. + + Fixes by: + * George Notaras -- http://www.g-loaded.eu + Reported by: + * Chris Hallman -- http://cdhallman.blogspot.com + + Changes in this release: + - Re-use time.time() instead of time.clock(). The 2007 implementation + worked only under Microsoft Windows. Failed on GNU/Linux. + time.clock() behaves differently under the two OSes[1]. + + [1] http://docs.python.org/library/time.html#time.clock + + September 25, 2010 + ------------------ + Little modifications by Georgi Kolev: + - Added quiet_ping function. + - returns percent lost packages, max round trip time, avrg round trip + time + - Added packet size to verbose_ping & quiet_ping functions. + - Bump up version to 0.2 + +""" + +__version__ = "0.2" + +import os +import select +import socket +import struct +import sys +import time + +# From /usr/include/linux/icmp.h; your milage may vary. +ICMP_ECHO_REQUEST = 8 # Seems to be the same on Solaris. + + +def checksum(source_string): + """ + I'm not too confident that this is right but testing seems + to suggest that it gives the same answers as in_cksum in ping.c + """ + sum = 0 + count_to = (len(source_string) / 2) * 2 + for count in xrange(0, count_to, 2): + this = ord(source_string[count + 1]) * 256 + ord(source_string[count]) + sum = sum + this + sum = sum & 0xffffffff # Necessary? + + if count_to < len(source_string): + sum = sum + ord(source_string[len(source_string) - 1]) + sum = sum & 0xffffffff # Necessary? + + sum = (sum >> 16) + (sum & 0xffff) + sum = sum + (sum >> 16) + answer = ~sum + answer = answer & 0xffff + + # Swap bytes. Bugger me if I know why. + answer = answer >> 8 | (answer << 8 & 0xff00) + + return answer + + +def receive_one_ping(my_socket, id, timeout): + """ + Receive the ping from the socket. + """ + time_left = timeout + while True: + started_select = time.time() + what_ready = select.select([my_socket], [], [], time_left) + how_long_in_select = (time.time() - started_select) + if what_ready[0] == []: # Timeout + return + + time_received = time.time() + received_packet, addr = my_socket.recvfrom(1024) + icmpHeader = received_packet[20:28] + type, code, checksum, packet_id, sequence = struct.unpack( + "bbHHh", icmpHeader + ) + if packet_id == id: + bytes = struct.calcsize("d") + time_sent = struct.unpack("d", received_packet[28:28 + bytes])[0] + return time_received - time_sent + + time_left = time_left - how_long_in_select + if time_left <= 0: + return + + +def send_one_ping(my_socket, dest_addr, id, psize): + """ + Send one ping to the given >dest_addr<. + """ + dest_addr = socket.gethostbyname(dest_addr) + + # Remove header size from packet size + psize = psize - 8 + + # Header is type (8), code (8), checksum (16), id (16), sequence (16) + my_checksum = 0 + + # Make a dummy heder with a 0 checksum. + header = struct.pack("bbHHh", ICMP_ECHO_REQUEST, 0, my_checksum, id, 1) + bytes = struct.calcsize("d") + data = (psize - bytes) * "Q" + data = struct.pack("d", time.time()) + data + + # Calculate the checksum on the data and the dummy header. + my_checksum = checksum(header + data) + + # Now that we have the right checksum, we put that in. It's just easier + # to make up a new header than to stuff it into the dummy. + header = struct.pack( + "bbHHh", ICMP_ECHO_REQUEST, 0, socket.htons(my_checksum), id, 1 + ) + packet = header + data + my_socket.sendto(packet, (dest_addr, 1)) # Don't know about the 1 + + +def do_one(dest_addr, timeout, psize): + """ + Returns either the delay (in seconds) or none on timeout. + """ + icmp = socket.getprotobyname("icmp") + try: + my_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, icmp) + except socket.error, (errno, msg): + if errno == 1: + # Operation not permitted + msg = msg + ( + " - Note that ICMP messages can only be sent from processes" + " running as root." + ) + raise socket.error(msg) + raise # raise the original error + + my_id = os.getpid() & 0xFFFF + + send_one_ping(my_socket, dest_addr, my_id, psize) + delay = receive_one_ping(my_socket, my_id, timeout) + + my_socket.close() + return delay + + +def verbose_ping(dest_addr, timeout = 2, count = 4, psize = 64): + """ + Send `count' ping with `psize' size to `dest_addr' with + the given `timeout' and display the result. + """ + for i in xrange(count): + print "ping %s with ..." % dest_addr, + try: + delay = do_one(dest_addr, timeout, psize) + except socket.gaierror, e: + print "failed. (socket error: '%s')" % e[1] + break + + if delay == None: + print "failed. (timeout within %ssec.)" % timeout + else: + delay = delay * 1000 + print "get ping in %0.4fms" % delay + print + + +def quiet_ping(dest_addr, timeout = 2, count = 4, psize = 64): + """ + Send `count' ping with `psize' size to `dest_addr' with + the given `timeout' and display the result. + Returns `percent' lost packages, `max' round trip time + and `avrg' round trip time. + """ + mrtt = None + artt = None + lost = 0 + plist = [] + + for i in xrange(count): + try: + delay = do_one(dest_addr, timeout, psize) + except socket.gaierror, e: + print "failed. (socket error: '%s')" % e[1] + break + + if delay != None: + delay = delay * 1000 + plist.append(delay) + + # Find lost package percent + percent_lost = 100 - (len(plist) * 100 / count) + + # Find max and avg round trip time + if plist: + mrtt = max(plist) + artt = sum(plist) / len(plist) + + return percent_lost, mrtt, artt + +if __name__ == '__main__': + verbose_ping("heise.de") + verbose_ping("google.com") + verbose_ping("a-test-url-taht-is-not-available.com") + verbose_ping("192.168.1.1") diff --git a/ping-0.2/debian/python-ping/usr/share/python-support/python-ping.public b/ping-0.2/debian/python-ping/usr/share/python-support/python-ping.public new file mode 100644 index 0000000..fe3edd6 --- /dev/null +++ b/ping-0.2/debian/python-ping/usr/share/python-support/python-ping.public @@ -0,0 +1,2 @@ +/usr/share/pyshared/ping-0.2.egg-info +/usr/share/pyshared/ping.py diff --git a/ping-0.2/debian/rules b/ping-0.2/debian/rules new file mode 100755 index 0000000..b760bee --- /dev/null +++ b/ping-0.2/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ diff --git a/ping-0.2/debian/source/format b/ping-0.2/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/ping-0.2/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/ping-0.2/debian/watch.ex b/ping-0.2/debian/watch.ex new file mode 100644 index 0000000..c280a37 --- /dev/null +++ b/ping-0.2/debian/watch.ex @@ -0,0 +1,23 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php python-ping-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/python-ping-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/python-ping-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/python-ping/python-ping-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html python-ping-(.*)\.tar\.gz -- cgit v1.2.3