Skip to content

Commit 9743286

Browse files
author
djon3s
committed
non functioning txtorcon
1 parent b313b36 commit 9743286

3 files changed

Lines changed: 143 additions & 6 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
*** util.py 2012-11-22 06:36:56.000000000 +1100
2+
--- ../util.py 2013-02-27 00:06:21.453769507 +1100
3+
***************
4+
*** 10,53 ****
5+
import socket
6+
import subprocess
7+
8+
- try:
9+
- import GeoIP
10+
-
11+
- def create_geoip(fname):
12+
- try:
13+
- ## It's more "pythonic" to just wait for the exception,
14+
- ## but GeoIP prints out "Can't open..." messages for you,
15+
- ## which isn't desired here
16+
- if not os.path.isfile(fname):
17+
- raise IOError("Can't find %s" % fname)
18+
- return GeoIP.open(fname, GeoIP.GEOIP_STANDARD)
19+
-
20+
- except GeoIP.error:
21+
- raise IOError("Can't load %s" % fname)
22+
-
23+
- except ImportError:
24+
- import pygeoip
25+
- create_geoip = pygeoip.GeoIP
26+
27+
city = None
28+
country = None
29+
asn = None
30+
31+
- try:
32+
- city = create_geoip("/usr/share/GeoIP/GeoLiteCity.dat")
33+
- except IOError:
34+
- city = None
35+
-
36+
- try:
37+
- asn = create_geoip("/usr/share/GeoIP/GeoIPASNum.dat")
38+
- except IOError:
39+
- asn = None
40+
-
41+
- try:
42+
- country = create_geoip("/usr/share/GeoIP/IP.dat")
43+
- except IOError:
44+
- country = None
45+
-
46+
47+
def find_keywords(args):
48+
"""
49+
--- 10,20 ----
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
*** setup.py 2013-02-26 01:46:32.851402490 +1100
2+
--- ../setup.py 2013-02-26 01:47:16.403403772 +1100
3+
***************
4+
*** 46,52 ****
5+
author_email = __contact__,
6+
url = __url__,
7+
license = __license__,
8+
! packages = ["txtorcon", "txtorcon.test"],
9+
# scripts = ['examples/attach_streams_by_country.py'],
10+
11+
## I'm a little unclear if I'm doing this "properly", especially
12+
--- 46,52 ----
13+
author_email = __contact__,
14+
url = __url__,
15+
license = __license__,
16+
! packages = ["txtorcon", ],
17+
# scripts = ['examples/attach_streams_by_country.py'],
18+
19+
## I'm a little unclear if I'm doing this "properly", especially
20+
***************
21+
*** 54,67 ****
22+
## the first member of the tuple? Why does it seem I need to
23+
## duplicate this in MANIFEST.in?
24+
25+
! data_files = [('share/txtorcon', ['INSTALL', 'README', 'TODO', 'meejah.asc']),
26+
27+
## this includes the Sphinx source for the
28+
## docs. The "map+filter" construct grabs all .rst
29+
## files and re-maps the path
30+
! ('share/txtorcon', ['docs/apilinks_sphinxext.py', 'docs/conf.py', 'docs/Makefile'] + map(lambda x: os.path.join('docs', x), filter(lambda x: x[-3:] == 'rst', os.listdir('docs'))) + map(lambda x: os.path.join('docs/_static', x), os.listdir('docs/_static'))),
31+
32+
## include all the examples
33+
! ('share/txtorcon/examples', map(lambda x: os.path.join('examples', x), filter(lambda x: x[-3:] == '.py', os.listdir('examples'))))
34+
]
35+
)
36+
--- 54,67 ----
37+
## the first member of the tuple? Why does it seem I need to
38+
## duplicate this in MANIFEST.in?
39+
40+
! data_files = [#('share/txtorcon', ['INSTALL', 'README', 'TODO', 'meejah.asc']),
41+
42+
## this includes the Sphinx source for the
43+
## docs. The "map+filter" construct grabs all .rst
44+
## files and re-maps the path
45+
! #('share/txtorcon', ['docs/apilinks_sphinxext.py', 'docs/conf.py', 'docs/Makefile'] + map(lambda x: os.path.join('docs', x), filter(lambda x: x[-3:] == 'rst', os.listdir('docs'))) + map(lambda x: os.path.join('docs/_static', x), os.listdir('docs/_static'))),
46+
47+
## include all the examples
48+
! #('share/txtorcon/examples', map(lambda x: os.path.join('examples', x), filter(lambda x: x[-3:] == '.py', os.listdir('examples'))))
49+
]
50+
)

recipes/txtorcon/recipe.sh

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,69 @@
44
VERSION_txtorcon=
55

66
# dependencies of this recipe
7-
DEPS_txtorcon=(tor twisted)
7+
DEPS_txtorcon=(tor setuptools twisted)
88

99
# url of the
10-
URL_txtorcon=https://github.com/meejah/txtorcon/archive/3b370a0cc77ee7c52fcd956611c5aed244c19a96.zip
10+
#URL_txtorcon=https://github.com/meejah/txtorcon/archive/3b370a0cc77ee7c52fcd956611c5aed244c19a96.zip
11+
URL_txtorcon=https://github.com/meejah/txtorcon/archive/v0.7.tar.gz
1112

1213
# md5 of the package
13-
MD5_pylibpd=
14+
MD5_txtorcon=
1415

1516
# default build path
16-
BUILD_pylibpd=$BUILD_PATH/txtorcon/$(get_directory $URL_txtorcon)
17+
BUILD_txtorcon=$BUILD_PATH/txtorcon/$(get_directory $URL_txtorcon)
1718

1819
# default recipe path
1920
RECIPE_txtorcon=$RECIPES_PATH/txtorcon
2021

2122
# function called for preparing source code if needed
2223
# (you can apply patch etc here.)
2324
function prebuild_txtorcon() {
24-
true
25+
26+
cd $BUILD_txtorcon
27+
# check marker in our source build
28+
if [ -f .patched ]; then
29+
# no patch needed
30+
return
31+
fi
32+
33+
cd $BUILD_txtorcon/txtorcon
34+
try patch -p1 -i $RECIPE_txtorcon/patches/no-pygeoip.patch
35+
cd $BUILD_txtorcon
36+
# try patch -p1 -i $RECIPE_txtorcon/patches/setup.py.patch
37+
#
38+
# everything done, touch the marker !
39+
touch .patched
40+
# true
2541
}
2642

2743
# function called to build the source code
2844
function build_txtorcon() {
2945
cd $BUILD_txtorcon
46+
3047
push_arm
31-
try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
48+
# try $BUILD_PATH/python-install/bin/python.host setup.py install -O2
49+
50+
# NEW
51+
export LDFLAGS="$LDFLAGS -L$LIBS_PATH"
52+
export LDSHARED="$LIBLINK"
53+
54+
export PYTHONPATH=$BUILD_hostpython/Lib/site-packages
55+
56+
# fake try to be able to cythonize generated files
57+
$BUILD_PATH/python-install/bin/python.host setup.py build
58+
try find . -iname '*.pyx' -exec cython {} \;
59+
try $BUILD_PATH/python-install/bin/python.host setup.py build
60+
#try find build/lib.* -name "*.o" -exec $STRIP {} \;
61+
62+
try $BUILD_hostpython/hostpython setup.py install -O2 --root=$BUILD_PATH/python-install --install-lib=lib/python2.7/site-packages
63+
64+
try rm -rf $BUILD_PATH/python-install/lib/python*/dist-packages/txtorcon*/txtorcon/test
65+
try rm -rf $BUILD_PATH/python-install/lib/python*/dist-packages/txtorcon*/share/txtorcon/examples
66+
67+
unset LDSHARED
68+
69+
3270
pop_arm
3371
}
3472

0 commit comments

Comments
 (0)