ó
—r¼Mc           @   s§   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z d e j f d „  ƒ  YZ i d d 6d d 6d d 6d	 d	 6Z d
 „  Z	 d „  Z
 e d k r£ e
 ƒ  n  d S(   iÿÿÿÿN(   t   usaget	   MyOptionsc           B   s™   e  Z d  d g g Z d d d g d d d d g d	 d
 d g d d d g d d d g d d d g d d d g d d d d g g Z i d d 6Z d „  Z RS(   t   unsignedt   ut   tapfilet   ts
   twistd.tapt
   maintainert   mt    sV   The maintainer's name and email in a specific format: 'John Doe <johndoe@example.com>'t   protocolt   pt   descriptiont   et   long_descriptiont   ls   set-versiont   Vs   1.0t   debfilet   dt   typet   yt   tapsG   type of configuration: 'tap', 'xml, 'source' or 'python' for .tac filess   (tap xml source python)c         C   s   |  d s t  j d ‚ n  d  S(   NR   s   maintainer must be specified.(   R    t
   UsageError(   t   self(    (    s;   /usr/lib/python2.7/dist-packages/twisted/scripts/tap2deb.pyt   postOptions   s    
N(   t   __name__t
   __module__t   optFlagst   Nonet   optParameterst   zsh_actionsR   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/scripts/tap2deb.pyR   
   s   t   fileR   t   pythont   sourcet   xmlc         C   s*   t  |  d ƒ } | j | ƒ | j ƒ  d  S(   Nt   w(   t   opent   writet   close(   R   t   textt   f(    (    s;   /usr/lib/python2.7/dist-packages/twisted/scripts/tap2deb.pyt   save_to_file(   s    c       
   C   s  y t  ƒ  }  |  j ƒ  Wn4 t j k
 rM } t j d t j d | f ƒ n X|  d } t j j	 |  d ƒ } |  d p‹ t j j
 | ƒ d } |  d pŸ d | } |  d } |  d } |  d	 pÊ d
 t ƒ  } |  d pÚ d }	 t |  d }
 t j t j d ƒ j ƒ  ƒ } | d | } d t j d  } t j j t j j d | ƒ ƒ rlt j d t j j d | ƒ ƒ n  t j t j j d | d ƒ ƒ t j | t j j d | ƒ ƒ t t j j d | d d ƒ d ƒ t t j j d | d d ƒ d t ƒ  ƒ t t j j d | d d ƒ d t ƒ  ƒ t t j j d | d d ƒ d t ƒ  ƒ t j t j j d | d d ƒ d ƒ t t j j d | d d ƒ d t ƒ  ƒ t t j j d | d d  ƒ d! t ƒ  ƒ t t j j d | d d" ƒ d# t ƒ  ƒ t t j j d | d d$ ƒ d% t ƒ  ƒ t t j j d | d d& ƒ d' t ƒ  ƒ t t j j d | d d( ƒ d) t ƒ  ƒ t t j j d | d d* ƒ d+ t ƒ  ƒ t t j j d | d d, ƒ d- t ƒ  ƒ t j t j j d | d d, ƒ d ƒ t j d. t ƒ  ƒ t j d/ d0 d1 g |  d2 ƒ d  S(3   Ns   %s: %si    R   R	   R   s   twisted-s   set-versionR   R   s'   A Twisted-based server for %(protocol)sR   s    Automatically created by tap2debR   s   date -Rt   -s   %s.%si   s   .builds	   rm -rf %st   debians   README.Debians+   This package was auto-generated by tap2deb
t	   conffilessJ   /etc/init.d/%(deb_file)s
/etc/default/%(deb_file)s
/etc/%(base_tap_file)s
t   defaultsz   pidfile=/var/run/%(deb_file)s.pid
rundir=/var/lib/%(deb_file)s/
file=/etc/%(tap_file)s
logfile=/var/log/%(deb_file)s.log
 s   init.ds@  #!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin

pidfile=/var/run/%(deb_file)s.pid rundir=/var/lib/%(deb_file)s/ file=/etc/%(tap_file)s logfile=/var/log/%(deb_file)s.log

[ -r /etc/default/%(deb_file)s ] && . /etc/default/%(deb_file)s

test -x /usr/bin/twistd || exit 0
test -r $file || exit 0
test -r /usr/share/%(deb_file)s/package-installed || exit 0


case "$1" in
    start)
        echo -n "Starting %(deb_file)s: twistd"
        start-stop-daemon --start --quiet --exec /usr/bin/twistd --                           --pidfile=$pidfile                           --rundir=$rundir                           --%(twistd_option)s=$file                           --logfile=$logfile
        echo "."	
    ;;

    stop)
        echo -n "Stopping %(deb_file)s: twistd"
        start-stop-daemon --stop --quiet              --pidfile $pidfile
        echo "."	
    ;;

    restart)
        $0 stop
        $0 start
    ;;

    force-reload)
        $0 restart
    ;;

    *)
        echo "Usage: /etc/init.d/%(deb_file)s {start|stop|restart|force-reload}" >&2
        exit 1
    ;;
esac

exit 0
ií  t   postinstsb   #!/bin/sh
update-rc.d %(deb_file)s defaults >/dev/null
invoke-rc.d %(deb_file)s start
#DEBHELPER#
t   prerms4   #!/bin/sh
invoke-rc.d %(deb_file)s stop
#DEBHELPER#
t   postrmsZ   #!/bin/sh
if [ "$1" = purge ]; then
        update-rc.d %(deb_file)s remove >/dev/null
fi
t	   changelogsh   %(deb_file)s (%(version)s) unstable; urgency=low

  * Created by tap2deb

 -- %(maintainer)s  %(date)s

t   controlsg  Source: %(deb_file)s
Section: net
Priority: extra
Maintainer: %(maintainer)s
Build-Depends-Indep: debhelper, python (>= 2.6.5-7)
Standards-Version: 3.8.4
XS-Python-Version: current

Package: %(deb_file)s
Architecture: all
Depends: ${python:Depends}, python-twisted-core
XB-Python-Version: ${python:Versions}
Description: %(description)s
 %(long_description)s
t	   copyrightsÔ   This package was auto-debianized by %(maintainer)s on
%(date)s

It was auto-generated by tap2deb

Upstream Author(s): 
Moshe Zadka <moshez@twistedmatrix.com> -- tap2deb author

Copyright:

Insert copyright here.
t   dirss^   etc/init.d
etc/default
var/lib/%(deb_file)s
usr/share/doc/%(deb_file)s
usr/share/%(deb_file)s
t   ruless{  #!/usr/bin/make -f

export DH_COMPAT=5

build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp
	dh_clean

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp.
	cp %(base_tap_file)s debian/tmp/etc/
	cp debian/init.d debian/tmp/etc/init.d/%(deb_file)s
	cp debian/default debian/tmp/etc/default/%(deb_file)s
	cp debian/copyright debian/tmp/usr/share/doc/%(deb_file)s/
	cp debian/README.Debian debian/tmp/usr/share/doc/%(deb_file)s/
	touch debian/tmp/usr/share/%(deb_file)s/package-installed
	touch install-stamp

binary-arch: build install

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_strip
	dh_compress
	dh_installchangelogs
	dh_python2
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
s   .build/%(directory)ss   dpkg-buildpackage -rfakerootR   s    -uc -usR   (   R   t   parseOptionsR    t   errort   syst   exitt   argvt   ost   patht   basenamet   splitextt   varst	   type_dictt   stringt   stript   popent   readt   version_infot   existst   joint   systemt   makedirst   shutilt   copyR(   t   chmodt   chdir(   t   configt   uet   tap_filet   base_tap_fileR	   t   deb_filet   versionR   R   R   t   twistd_optiont   datet	   directoryt   python_version(    (    s;   /usr/lib/python2.7/dist-packages/twisted/scripts/tap2deb.pyt   run.   sd    	"
 


!#4%5%t   __main__(   R7   R:   R@   RI   t   twisted.pythonR    t   OptionsR   R?   R(   RW   R   (    (    (    s;   /usr/lib/python2.7/dist-packages/twisted/scripts/tap2deb.pyt   <module>   s   0
		í