rpms/python-GeoIP/devel GeoIP-Python-1.2.1-ccodes.patch,NONE,1.1
Michael G. Fleming (mfleming)
fedora-extras-commits at redhat.com
Thu Sep 13 07:20:51 UTC 2007
Author: mfleming
Update of /cvs/extras/rpms/python-GeoIP/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15924
Added Files:
GeoIP-Python-1.2.1-ccodes.patch
Log Message:
* Wed Sep 5 2007 Michael Fleming <mfleming+rpm at enlartenment.com> 1.2.1-7
- Add patch to expose country codes courtesy of Ignacio Vazquez-Adams
(bz #243696)
GeoIP-Python-1.2.1-ccodes.patch:
--- NEW FILE GeoIP-Python-1.2.1-ccodes.patch ---
diff -up GeoIP-Python-1.2.1/py_GeoIP.c.ccodes GeoIP-Python-1.2.1/py_GeoIP.c
--- GeoIP-Python-1.2.1/py_GeoIP.c.ccodes 2005-06-28 09:28:37.000000000 -0400
+++ GeoIP-Python-1.2.1/py_GeoIP.c 2007-09-04 19:00:51.000000000 -0400
@@ -306,6 +306,28 @@ initGeoIP(void)
m = Py_InitModule("GeoIP", GeoIP_Class_methods);
d = PyModule_GetDict(m);
+ int total_ccodes = 251;
+
+ PyObject *ccode = PyTuple_New(total_ccodes);
+ PyObject *cname = PyDict_New();
+ PyObject *ccont = PyDict_New();
+ PyObject *s;
+
+ int i = 0;
+ for (; i<total_ccodes; i++)
+ {
+ s = PyString_FromString(GeoIP_country_code[i]);
+ PyTuple_SET_ITEM(ccode, i, s);
+ Py_INCREF(s);
+ PyDict_SetItem(cname, s, PyString_FromString(GeoIP_country_name[i]));
+ Py_INCREF(s);
+ PyDict_SetItem(ccont, s, PyString_FromString(GeoIP_country_continent[i]));
+ };
+
+ PyDict_SetItemString(d, "country_codes", ccode);
+ PyDict_SetItemString(d, "country_names", cname);
+ PyDict_SetItemString(d, "country_continents", ccont);
+
tmp = PyInt_FromLong(0);
PyDict_SetItemString(d, "GEOIP_STANDARD", tmp);
Py_DECREF(tmp);
More information about the fedora-extras-commits
mailing list