Package-Name: BitTorrent
Requires: python pygtk
Homepage: http://bitconjurer.org/BitTorrent/
#Source: http://bitconjurer.org/BitTorrent/download.html/<a href="(BitTorrent-\d+\.\d+(\.\d+\w*)?\.tar\.gz)">/[\0-\377]*?BitTorrent-(\d+.\d+(.\d\w*)?).tar.gz $1
Source: sourceforge:///bittorrent/BitTorrent-(\d+(.\d+)+\w*).tar.gz $1
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
Compile:
	cp -pf LICENSE.txt README.txt credits.txt "$(PREFIX)/"
	mv -f BitTorrent/__init__.py BitTorrent/__init__.py~
	sed "s@^app_root = os.path.split.*@app_root = '$(PREFIX)/bin'@" <BitTorrent/__init__.py~ >BitTorrent/__init__.py
	ONEUP=`dirname "$(PREFIX)"` ; \
	umask 022 ; python setup.py build install -c -O1 --prefix="$(PREFIX)" --install-lib="$$ONEUP/python/lib/python`cat $$ONEUP/python/.version | cut -d. -f1-2`/site-packages"
Install:
	$(MAKE) instbin BIN="bittorrent bittorrent-console bittorrent-curses bittorrent-tracker changetracker-console launchmany-console launchmany-curses maketorrent maketorrent-console torrentinfo-console"

Patch: <<EOT
######## begin shell which -> type patch
--- BitTorrent/LaunchPath.py.old	2005-11-22 09:59:08 +0900
+++ BitTorrent/LaunchPath.py	2006-08-07 00:37:01 +0900
@@ -46,7 +46,7 @@
     launchpath = launchpath_mac
 elif os.name == 'posix':
     for b in posix_browsers:
-        if os.system("which '%s' >/dev/null 2>&1" % b.replace("'","\\'")) == 0:
+        if os.system("type '%s' >/dev/null 2>&1" % b.replace("'","\\'")) == 0:
             can_launch_files = True
             default_posix_browser = b
             launchpath = launchpath_posix
######## end shell which -> type patch
EOT
NoPatch: <<EOT
######## begin no donation nag
--- ../BitTorrent-4.1.4-orig/bittorrent.py	2005-08-16 11:13:28 +0900
+++ bittorrent.py	2005-09-05 11:13:38 +0900
@@ -3373,7 +3373,7 @@
 
     def nag(self):
         if ((self.config['donated'] != version) and
-            (random.random() * NAG_FREQUENCY) < 1):
+            (random.random() * NAG_FREQUENCY) < 0):
             title = _("Have you donated?")
             message = _("Welcome to the new version of %s. Have you donated?")%app_name
             self.nagwindow = MessageDialog(self.mainwindow,
######## end no donation nag
EOT

/pkg/BitTorrent/
/pkg/python/lib/*/site-packages/BitTorrent/
/usr/bin/bittorrent
/usr/bin/bittorrent-console
/usr/bin/bittorrent-curses
/usr/bin/bittorrent-tracker
/usr/bin/changetracker-console
/usr/bin/launchmany-console
/usr/bin/launchmany-curses
/usr/bin/maketorrent
/usr/bin/maketorrent-console
/usr/bin/torrentinfo-console
