Guest User

Untitled

a guest
May 20th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.06 KB | None | 0 0
  1. diff -ruN raw/Python-2.5.2/configure.in Python-2.5.2/configure.in
  2. --- raw/Python-2.5.2/configure.in 2008-02-13 14:17:17.000000000 -0500
  3. +++ Python-2.5.2/configure.in 2008-06-06 21:25:02.000000000 -0400
  4. @@ -3410,44 +3410,6 @@
  5.  
  6.  
  7.  
  8. -AC_MSG_CHECKING(for %zd printf() format support)
  9. -AC_TRY_RUN([#include <stdio.h>
  10. -#include <stddef.h>
  11. -#include <string.h>
  12. -
  13. -#ifdef HAVE_SYS_TYPES_H
  14. -#include <sys/types.h>
  15. -#endif
  16. -
  17. -#ifdef HAVE_SSIZE_T
  18. -typedef ssize_t Py_ssize_t;
  19. -#elif SIZEOF_VOID_P == SIZEOF_LONG
  20. -typedef long Py_ssize_t;
  21. -#else
  22. -typedef int Py_ssize_t;
  23. -#endif
  24. -
  25. -int main()
  26. -{
  27. - char buffer[256];
  28. -
  29. - if(sprintf(buffer, "%zd", (size_t)123) < 0)
  30. - return 1;
  31. -
  32. - if (strcmp(buffer, "123"))
  33. - return 1;
  34. -
  35. - if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
  36. - return 1;
  37. -
  38. - if (strcmp(buffer, "-123"))
  39. - return 1;
  40. -
  41. - return 0;
  42. -}],
  43. -[AC_MSG_RESULT(yes)
  44. - AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
  45. - AC_MSG_RESULT(no))
  46.  
  47. AC_CHECK_TYPE(socklen_t,,
  48. AC_DEFINE(socklen_t,int,
  49. Binary files raw/Python-2.5.2/hostpython and Python-2.5.2/hostpython differ
  50. diff -ruN raw/Python-2.5.2/Lib/traceback.py Python-2.5.2/Lib/traceback.py
  51. --- raw/Python-2.5.2/Lib/traceback.py 2006-09-24 08:50:28.000000000 -0400
  52. +++ Python-2.5.2/Lib/traceback.py 2008-06-07 21:12:55.000000000 -0400
  53. @@ -1,6 +1,6 @@
  54. """Extract, format and print information about Python stack traces."""
  55.  
  56. -import linecache
  57. +#import linecache
  58. import sys
  59. import types
  60.  
  61. @@ -65,8 +65,9 @@
  62. name = co.co_name
  63. _print(file,
  64. ' File "%s", line %d, in %s' % (filename,lineno,name))
  65. - linecache.checkcache(filename)
  66. - line = linecache.getline(filename, lineno, f.f_globals)
  67. + #linecache.checkcache(filename)
  68. + #line = linecache.getline(filename, lineno, f.f_globals)
  69. + line = None
  70. if line: _print(file, ' ' + line.strip())
  71. tb = tb.tb_next
  72. n = n+1
  73. @@ -97,8 +98,9 @@
  74. co = f.f_code
  75. filename = co.co_filename
  76. name = co.co_name
  77. - linecache.checkcache(filename)
  78. - line = linecache.getline(filename, lineno, f.f_globals)
  79. + #linecache.checkcache(filename)
  80. + #line = linecache.getline(filename, lineno, f.f_globals)
  81. + line = None
  82. if line: line = line.strip()
  83. else: line = None
  84. list.append((filename, lineno, name, line))
  85. @@ -294,8 +296,9 @@
  86. co = f.f_code
  87. filename = co.co_filename
  88. name = co.co_name
  89. - linecache.checkcache(filename)
  90. - line = linecache.getline(filename, lineno, f.f_globals)
  91. + #linecache.checkcache(filename)
  92. + #line = linecache.getline(filename, lineno, f.f_globals)
  93. + line = None
  94. if line: line = line.strip()
  95. else: line = None
  96. list.append((filename, lineno, name, line))
  97. diff -ruN raw/Python-2.5.2/Makefile.pre.in Python-2.5.2/Makefile.pre.in
  98. --- raw/Python-2.5.2/Makefile.pre.in 2007-12-05 15:43:57.000000000 -0500
  99. +++ Python-2.5.2/Makefile.pre.in 2008-06-06 21:26:29.000000000 -0400
  100. @@ -173,6 +173,7 @@
  101.  
  102. PYTHON= python$(EXE)
  103. BUILDPYTHON= python$(BUILDEXE)
  104. +HOSTPYTHON= ./$(BUILDPYTHON)
  105.  
  106. # === Definitions added by makesetup ===
  107.  
  108. @@ -200,6 +201,8 @@
  109. # Parser
  110. PGEN= Parser/pgen$(EXE)
  111.  
  112. +HOSTPGEN= $(PGEN)
  113. +
  114. POBJS= \
  115. Parser/acceler.o \
  116. Parser/grammar1.o \
  117. @@ -347,10 +350,7 @@
  118.  
  119. # Build the shared modules
  120. sharedmods: $(BUILDPYTHON)
  121. - case $$MAKEFLAGS in \
  122. - *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
  123. - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
  124. - esac
  125. + echo 'What'
  126.  
  127. # Build static library
  128. # avoid long command lines, same as LIBRARY_OBJS
  129. @@ -474,7 +474,7 @@
  130.  
  131. $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
  132. -@ mkdir Include
  133. - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  134. + -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  135.  
  136. $(PGEN): $(PGENOBJS)
  137. $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
  138. @@ -781,20 +781,20 @@
  139. done; \
  140. done
  141. $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
  142. - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  143. - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
  144. + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  145. + $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
  146. -d $(LIBDEST) -f \
  147. -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  148. - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  149. - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
  150. + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  151. + $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
  152. -d $(LIBDEST) -f \
  153. -x 'bad_coding|badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  154. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  155. - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
  156. + $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
  157. -d $(LIBDEST)/site-packages -f \
  158. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  159. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  160. - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
  161. + $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
  162. -d $(LIBDEST)/site-packages -f \
  163. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  164.  
  165. @@ -894,12 +894,7 @@
  166. # Install the dynamically loadable modules
  167. # This goes into $(exec_prefix)
  168. sharedinstall:
  169. - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
  170. - --prefix=$(prefix) \
  171. - --install-scripts=$(BINDIR) \
  172. - --install-platlib=$(DESTSHARED) \
  173. - --root=/$(DESTDIR)
  174. -
  175. + echo 'Skipping sharedinstall'
  176. # Here are a couple of targets for MacOSX again, to install a full
  177. # framework-based Python. frameworkinstall installs everything, the
  178. # subtargets install specific parts. Much of the actual work is offloaded to
  179.  
  180. diff -ruN raw/Python-2.5.2/Modules/getaddrinfo.c Python-2.5.2/Modules/getaddrinfo.c
  181. --- raw/Python-2.5.2/Modules/getaddrinfo.c 2003-08-17 17:28:39.000000000 -0400
  182. +++ Python-2.5.2/Modules/getaddrinfo.c 2008-06-07 15:00:26.000000000 -0400
  183. @@ -341,37 +341,7 @@
  184. }
  185. port = htons((u_short)atoi(servname));
  186. } else {
  187. - struct servent *sp;
  188. - char *proto;
  189. -
  190. - proto = NULL;
  191. - switch (pai->ai_socktype) {
  192. - case GAI_ANY:
  193. - proto = NULL;
  194. - break;
  195. - case SOCK_DGRAM:
  196. - proto = "udp";
  197. - break;
  198. - case SOCK_STREAM:
  199. - proto = "tcp";
  200. - break;
  201. - default:
  202. - fprintf(stderr, "panic!\n");
  203. - break;
  204. - }
  205. - if ((sp = getservbyname(servname, proto)) == NULL)
  206. - ERR(EAI_SERVICE);
  207. - port = sp->s_port;
  208. - if (pai->ai_socktype == GAI_ANY) {
  209. - if (strcmp(sp->s_proto, "udp") == 0) {
  210. - pai->ai_socktype = SOCK_DGRAM;
  211. - pai->ai_protocol = IPPROTO_UDP;
  212. - } else if (strcmp(sp->s_proto, "tcp") == 0) {
  213. - pai->ai_socktype = SOCK_STREAM;
  214. - pai->ai_protocol = IPPROTO_TCP;
  215. - } else
  216. - ERR(EAI_PROTOCOL); /*xxx*/
  217. - }
  218. + ERR(EAI_SERVICE);
  219. }
  220. }
  221.  
  222. @@ -424,7 +394,7 @@
  223. v4a = ntohl(v4a);
  224. if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
  225. pai->ai_flags &= ~AI_CANONNAME;
  226. - v4a >>= IN_CLASSA_NSHIFT;
  227. + v4a >>= 24;
  228. if (v4a == 0 || v4a == IN_LOOPBACKNET)
  229. pai->ai_flags &= ~AI_CANONNAME;
  230. break;
  231. @@ -489,6 +459,8 @@
  232. struct addrinfo *pai;
  233. int port0;
  234. {
  235. + return 1; // stub
  236. +#if 0
  237. u_short port = port0 & 0xffff;
  238. struct hostent *hp;
  239. struct addrinfo *cur;
  240. @@ -524,6 +496,7 @@
  241. /* bad: */
  242. *res = NULL;
  243. return error;
  244. +#endif
  245. }
  246.  
  247. static int
  248. @@ -552,23 +525,11 @@
  249. } else
  250. hp = getipnodebyname(hostname, af, AI_ADDRCONFIG, &h_error);
  251. #else
  252. - hp = gethostbyname(hostname);
  253. - h_error = h_errno;
  254. + hp = net_gethostbyname(hostname);
  255. +
  256. #endif
  257. if (hp == NULL) {
  258. - switch (h_error) {
  259. - case HOST_NOT_FOUND:
  260. - case NO_DATA:
  261. - error = EAI_NODATA;
  262. - break;
  263. - case TRY_AGAIN:
  264. - error = EAI_AGAIN;
  265. - break;
  266. - case NO_RECOVERY:
  267. - default:
  268. - error = EAI_FAIL;
  269. - break;
  270. - }
  271. + error = EAI_FAIL;
  272. goto free;
  273. }
  274.  
  275. diff -ruN raw/Python-2.5.2/Modules/getnameinfo.c Python-2.5.2/Modules/getnameinfo.c
  276. --- raw/Python-2.5.2/Modules/getnameinfo.c 2001-12-02 05:15:37.000000000 -0500
  277. +++ Python-2.5.2/Modules/getnameinfo.c 2008-06-07 15:00:26.000000000 -0400
  278. @@ -95,6 +95,9 @@
  279. size_t servlen;
  280. int flags;
  281. {
  282. + return ENI_MEMORY;
  283. +
  284. +#if 0
  285. struct gni_afd *gni_afd;
  286. struct servent *sp;
  287. struct hostent *hp;
  288. @@ -141,13 +144,7 @@
  289. return ENI_MEMORY;
  290. strcpy(serv, numserv);
  291. } else {
  292. - sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
  293. - if (sp) {
  294. - if (strlen(sp->s_name) > servlen)
  295. - return ENI_MEMORY;
  296. - strcpy(serv, sp->s_name);
  297. - } else
  298. - return ENI_NOSERVNAME;
  299. + return ENI_NOSERVNAME;
  300. }
  301.  
  302. switch (sa->sa_family) {
  303. @@ -155,7 +152,7 @@
  304. v4a = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
  305. if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
  306. flags |= NI_NUMERICHOST;
  307. - v4a >>= IN_CLASSA_NSHIFT;
  308. + v4a >>= 24;
  309. if (v4a == 0 || v4a == IN_LOOPBACKNET)
  310. flags |= NI_NUMERICHOST;
  311. break;
  312. @@ -181,7 +178,7 @@
  313. hp = getipnodebyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af, &h_error);
  314. #else
  315. hp = gethostbyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af);
  316. - h_error = h_errno;
  317. +
  318. #endif
  319.  
  320. if (hp) {
  321. @@ -200,15 +197,10 @@
  322. freehostent(hp);
  323. #endif
  324. } else {
  325. - if (flags & NI_NAMEREQD)
  326. - return ENI_NOHOSTNAME;
  327. - if (inet_ntop(gni_afd->a_af, addr, numaddr, sizeof(numaddr))
  328. - == NULL)
  329. - return ENI_NOHOSTNAME;
  330. - if (strlen(numaddr) > hostlen)
  331. - return ENI_MEMORY;
  332. + return ENI_MEMORY;
  333. strcpy(host, numaddr);
  334. }
  335. }
  336. return SUCCESS;
  337. +#endif
  338. }
  339. diff -ruN raw/Python-2.5.2/Modules/Setup.dist Python-2.5.2/Modules/Setup.dist
  340. --- raw/Python-2.5.2/Modules/Setup.dist 2006-08-06 03:26:21.000000000 -0400
  341. +++ Python-2.5.2/Modules/Setup.dist 2008-06-06 22:00:14.000000000 -0400
  342. @@ -109,9 +109,9 @@
  343. # This only contains the minimal set of modules required to run the
  344. # setup.py script in the root of the Python source tree.
  345.  
  346. -posix posixmodule.c # posix (UNIX) system calls
  347. -errno errnomodule.c # posix (UNIX) errno values
  348. -pwd pwdmodule.c # this is needed to find out the user's home dir
  349. +#posix posixmodule.c # posix (UNIX) system calls
  350. +#errno errnomodule.c # posix (UNIX) errno values
  351. +#pwd pwdmodule.c # this is needed to find out the user's home dir
  352. # if $HOME is not set
  353. _sre _sre.c # Fredrik Lundh's new regular expressions
  354. _codecs _codecsmodule.c # access to the builtin codecs and codec registry
  355. @@ -149,7 +149,7 @@
  356. # modules are to be built as shared libraries (see above for more
  357. # detail; also note that *static* reverses this effect):
  358.  
  359. -#*shared*
  360. +*static*
  361.  
  362. # GNU readline. Unlike previous Python incarnations, GNU readline is
  363. # now incorporated in an optional module, configured in the Setup file
  364. @@ -164,18 +164,18 @@
  365.  
  366. # Modules that should always be present (non UNIX dependent):
  367.  
  368. -#array arraymodule.c # array objects
  369. -#cmath cmathmodule.c # -lm # complex math library functions
  370. -#math mathmodule.c # -lm # math library functions, e.g. sin()
  371. -#_struct _struct.c # binary structure packing/unpacking
  372. +array arraymodule.c # array objects
  373. +cmath cmathmodule.c # -lm # complex math library functions
  374. +math mathmodule.c # -lm # math library functions, e.g. sin()
  375. +_struct _struct.c # binary structure packing/unpacking
  376. #time timemodule.c # -lm # time operations and variables
  377. -#operator operator.c # operator.add() and similar goodies
  378. -#_weakref _weakref.c # basic weak reference support
  379. -#_testcapi _testcapimodule.c # Python C API test module
  380. -#_random _randommodule.c # Random number generator
  381. -#collections collectionsmodule.c # Container types
  382. -#itertools itertoolsmodule.c # Functions creating iterators for efficient looping
  383. -#strop stropmodule.c # String manipulations
  384. +operator operator.c # operator.add() and similar goodies
  385. +_weakref _weakref.c # basic weak reference support
  386. +_testcapi _testcapimodule.c # Python C API test module
  387. +_random _randommodule.c # Random number generator
  388. +collections collectionsmodule.c # Container types
  389. +itertools itertoolsmodule.c # Functions creating iterators for efficient looping
  390. +strop stropmodule.c # String manipulations
  391.  
  392. #unicodedata unicodedata.c # static Unicode character database
  393.  
  394. @@ -484,4 +484,4 @@
  395. # xx xxmodule.c
  396.  
  397. # Another example -- the 'xxsubtype' module shows C-level subtyping in action
  398. -xxsubtype xxsubtype.c
  399. +#xxsubtype xxsubtype.c
  400. diff -ruN raw/Python-2.5.2/Modules/socketmodule.c Python-2.5.2/Modules/socketmodule.c
  401. --- raw/Python-2.5.2/Modules/socketmodule.c 2007-03-31 14:56:11.000000000 -0400
  402. +++ Python-2.5.2/Modules/socketmodule.c 2008-06-07 21:29:58.000000000 -0400
  403. @@ -241,7 +241,7 @@
  404. #ifndef MS_WINDOWS
  405.  
  406. /* Non-MS WINDOWS includes */
  407. -# include <netdb.h>
  408. +//# include <netdb.h>
  409.  
  410. /* Headers needed for inet_ntoa() and inet_addr() */
  411. # ifdef __BEOS__
  412. @@ -250,7 +250,7 @@
  413. # include <netdb.h>
  414. typedef size_t socklen_t;
  415. # else
  416. -# include <arpa/inet.h>
  417. +# include <network.h>
  418. # endif
  419.  
  420. # ifndef RISCOS
  421. @@ -747,9 +747,9 @@
  422.  
  423. /* See if the socket is ready */
  424. if (writing)
  425. - n = select(s->sock_fd+1, NULL, &fds, NULL, &tv);
  426. + n = net_select(s->sock_fd+1, NULL, &fds, NULL, &tv);
  427. else
  428. - n = select(s->sock_fd+1, &fds, NULL, NULL, &tv);
  429. + n = net_select(s->sock_fd+1, &fds, NULL, NULL, &tv);
  430. }
  431. #endif
  432.  
  433. @@ -1546,7 +1546,7 @@
  434. Py_BEGIN_ALLOW_THREADS
  435. timeout = internal_select(s, 0);
  436. if (!timeout)
  437. - newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
  438. + newfd = net_accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
  439. Py_END_ALLOW_THREADS
  440.  
  441. if (timeout == 1) {
  442. @@ -1572,11 +1572,12 @@
  443. SOCKETCLOSE(newfd);
  444. goto finally;
  445. }
  446. - addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf),
  447. + /*addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf),
  448. addrlen, s->sock_proto);
  449. +
  450. if (addr == NULL)
  451. - goto finally;
  452. -
  453. + goto finally;*/ // TODO: bring this back
  454. + addr = Py_None;
  455. res = PyTuple_Pack(2, sock, addr);
  456.  
  457. finally:
  458. @@ -1728,7 +1729,7 @@
  459. &level, &optname, &buf, &buflen))
  460. return NULL;
  461. }
  462. - res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen);
  463. + res = net_setsockopt(s->sock_fd, level, optname, (void *)buf, buflen);
  464. if (res < 0)
  465. return s->errorhandler();
  466. Py_INCREF(Py_None);
  467. @@ -1750,54 +1751,8 @@
  468. static PyObject *
  469. sock_getsockopt(PySocketSockObject *s, PyObject *args)
  470. {
  471. - int level;
  472. - int optname;
  473. - int res;
  474. - PyObject *buf;
  475. - socklen_t buflen = 0;
  476. -
  477. -#ifdef __BEOS__
  478. - /* We have incomplete socket support. */
  479. - PyErr_SetString(socket_error, "getsockopt not supported");
  480. + PyErr_SetString(socket_error, "getsockopt not implemented");
  481. return NULL;
  482. -#else
  483. -
  484. - if (!PyArg_ParseTuple(args, "ii|i:getsockopt",
  485. - &level, &optname, &buflen))
  486. - return NULL;
  487. -
  488. - if (buflen == 0) {
  489. - int flag = 0;
  490. - socklen_t flagsize = sizeof flag;
  491. - res = getsockopt(s->sock_fd, level, optname,
  492. - (void *)&flag, &flagsize);
  493. - if (res < 0)
  494. - return s->errorhandler();
  495. - return PyInt_FromLong(flag);
  496. - }
  497. -#ifdef __VMS
  498. - /* socklen_t is unsigned so no negative test is needed,
  499. - test buflen == 0 is previously done */
  500. - if (buflen > 1024) {
  501. -#else
  502. - if (buflen <= 0 || buflen > 1024) {
  503. -#endif
  504. - PyErr_SetString(socket_error,
  505. - "getsockopt buflen out of range");
  506. - return NULL;
  507. - }
  508. - buf = PyString_FromStringAndSize((char *)NULL, buflen);
  509. - if (buf == NULL)
  510. - return NULL;
  511. - res = getsockopt(s->sock_fd, level, optname,
  512. - (void *)PyString_AS_STRING(buf), &buflen);
  513. - if (res < 0) {
  514. - Py_DECREF(buf);
  515. - return s->errorhandler();
  516. - }
  517. - _PyString_Resize(&buf, buflen);
  518. - return buf;
  519. -#endif /* __BEOS__ */
  520. }
  521.  
  522. PyDoc_STRVAR(getsockopt_doc,
  523. @@ -1820,7 +1775,7 @@
  524. if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen))
  525. return NULL;
  526. Py_BEGIN_ALLOW_THREADS
  527. - res = bind(s->sock_fd, SAS2SA(&addrbuf), addrlen);
  528. + res = net_bind(s->sock_fd, SAS2SA(&addrbuf), addrlen);
  529. Py_END_ALLOW_THREADS
  530. if (res < 0)
  531. return s->errorhandler();
  532. @@ -1867,7 +1822,7 @@
  533. int res, timeout;
  534.  
  535. timeout = 0;
  536. - res = connect(s->sock_fd, addr, addrlen);
  537. + res = net_connect(s->sock_fd, addr, addrlen);
  538.  
  539. #ifdef MS_WINDOWS
  540.  
  541. @@ -1921,7 +1876,7 @@
  542. if (res < 0 && errno == EINPROGRESS && IS_SELECTABLE(s)) {
  543. timeout = internal_select(s, 1);
  544. if (timeout == 0) {
  545. - res = connect(s->sock_fd, addr, addrlen);
  546. + res = net_connect(s->sock_fd, addr, addrlen);
  547. if (res < 0 && errno == EISCONN)
  548. res = 0;
  549. }
  550. @@ -2061,6 +2016,9 @@
  551. static PyObject *
  552. sock_getsockname(PySocketSockObject *s)
  553. {
  554. + PyErr_SetString(socket_error, "getsockname not implemented");
  555. + return NULL;
  556. +#if 0
  557. sock_addr_t addrbuf;
  558. int res;
  559. socklen_t addrlen;
  560. @@ -2069,12 +2027,13 @@
  561. return NULL;
  562. memset(&addrbuf, 0, addrlen);
  563. Py_BEGIN_ALLOW_THREADS
  564. - res = getsockname(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
  565. + res = net_getsockname(s->sock_fd, SAS2SA(&addrbuf), &addrlen);
  566. Py_END_ALLOW_THREADS
  567. if (res < 0)
  568. return s->errorhandler();
  569. return makesockaddr(s->sock_fd, SAS2SA(&addrbuf), addrlen,
  570. s->sock_proto);
  571. +#endif
  572. }
  573.  
  574. PyDoc_STRVAR(getsockname_doc,
  575. @@ -2129,7 +2088,7 @@
  576. Py_BEGIN_ALLOW_THREADS
  577. if (backlog < 1)
  578. backlog = 1;
  579. - res = listen(s->sock_fd, backlog);
  580. + res = net_listen(s->sock_fd, backlog);
  581. Py_END_ALLOW_THREADS
  582. if (res < 0)
  583. return s->errorhandler();
  584. @@ -2235,7 +2194,7 @@
  585. Py_BEGIN_ALLOW_THREADS
  586. timeout = internal_select(s, 0);
  587. if (!timeout)
  588. - outlen = recv(s->sock_fd, cbuf, len, flags);
  589. + outlen = net_recv(s->sock_fd, cbuf, len, flags);
  590. Py_END_ALLOW_THREADS
  591.  
  592. if (timeout == 1) {
  593. @@ -2436,14 +2395,14 @@
  594. if (!timeout) {
  595. #ifndef MS_WINDOWS
  596. #if defined(PYOS_OS2) && !defined(PYCC_GCC)
  597. - n = recvfrom(s->sock_fd, cbuf, len, flags,
  598. + n = net_recvfrom(s->sock_fd, cbuf, len, flags,
  599. SAS2SA(&addrbuf), &addrlen);
  600. #else
  601. - n = recvfrom(s->sock_fd, cbuf, len, flags,
  602. + n = net_recvfrom(s->sock_fd, cbuf, len, flags,
  603. (void *) &addrbuf, &addrlen);
  604. #endif
  605. #else
  606. - n = recvfrom(s->sock_fd, cbuf, len, flags,
  607. + n = net_recvfrom(s->sock_fd, cbuf, len, flags,
  608. SAS2SA(&addrbuf), &addrlen);
  609. #endif
  610. }
  611. @@ -2585,7 +2544,7 @@
  612. #ifdef __VMS
  613. n = sendsegmented(s->sock_fd, buf, len, flags);
  614. #else
  615. - n = send(s->sock_fd, buf, len, flags);
  616. + n = net_send(s->sock_fd, buf, len, flags);
  617. #endif
  618. Py_END_ALLOW_THREADS
  619.  
  620. @@ -2629,7 +2588,7 @@
  621. #ifdef __VMS
  622. n = sendsegmented(s->sock_fd, buf, len, flags);
  623. #else
  624. - n = send(s->sock_fd, buf, len, flags);
  625. + n = net_send(s->sock_fd, buf, len, flags);
  626. #endif
  627. if (n < 0)
  628. break;
  629. @@ -2685,7 +2644,7 @@
  630. Py_BEGIN_ALLOW_THREADS
  631. timeout = internal_select(s, 1);
  632. if (!timeout)
  633. - n = sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen);
  634. + n = net_sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen);
  635. Py_END_ALLOW_THREADS
  636.  
  637. if (timeout == 1) {
  638. @@ -2716,7 +2675,7 @@
  639. if (how == -1 && PyErr_Occurred())
  640. return NULL;
  641. Py_BEGIN_ALLOW_THREADS
  642. - res = shutdown(s->sock_fd, how);
  643. + res = net_shutdown(s->sock_fd, how);
  644. Py_END_ALLOW_THREADS
  645. if (res < 0)
  646. return s->errorhandler();
  647. @@ -2875,10 +2834,10 @@
  648. return -1;
  649.  
  650. Py_BEGIN_ALLOW_THREADS
  651. - fd = socket(family, type, proto);
  652. + fd = net_socket(family, type, proto);
  653. Py_END_ALLOW_THREADS
  654.  
  655. -#ifdef MS_WINDOWS
  656. +#if 1
  657. if (fd == INVALID_SOCKET)
  658. #else
  659. if (fd < 0)
  660. @@ -2946,15 +2905,18 @@
  661. static PyObject *
  662. socket_gethostname(PyObject *self, PyObject *unused)
  663. {
  664. + return PyString_FromString("wii");
  665. +#if 0
  666. char buf[1024];
  667. int res;
  668. Py_BEGIN_ALLOW_THREADS
  669. - res = gethostname(buf, (int) sizeof buf - 1);
  670. + res = net_gethostname(buf, (int) sizeof buf - 1);
  671. Py_END_ALLOW_THREADS
  672. if (res < 0)
  673. return set_error();
  674. buf[sizeof buf - 1] = '\0';
  675. return PyString_FromString(buf);
  676. +#endif
  677. }
  678.  
  679. PyDoc_STRVAR(gethostname_doc,
  680. @@ -2998,11 +2960,7 @@
  681.  
  682. if (h == NULL) {
  683. /* Let's get real error message to return */
  684. -#ifndef RISCOS
  685. - set_herror(h_errno);
  686. -#else
  687. PyErr_SetString(socket_error, "host not found");
  688. -#endif
  689. return NULL;
  690. }
  691.  
  692. @@ -3171,7 +3129,7 @@
  693. #ifdef USE_GETHOSTBYNAME_LOCK
  694. PyThread_acquire_lock(netdb_lock, 1);
  695. #endif
  696. - h = gethostbyname(name);
  697. + h = net_gethostbyname(name);
  698. #endif /* HAVE_GETHOSTBYNAME_R */
  699. Py_END_ALLOW_THREADS
  700. /* Some C libraries would require addr.__ss_family instead of
  701. @@ -3200,6 +3158,9 @@
  702. static PyObject *
  703. socket_gethostbyaddr(PyObject *self, PyObject *args)
  704. {
  705. + PyErr_SetString(socket_error, "gethostbyaddr not implemented");
  706. + return NULL;
  707. +#if 0
  708. #ifdef ENABLE_IPV6
  709. struct sockaddr_storage addr;
  710. #else
  711. @@ -3275,6 +3236,7 @@
  712. PyThread_release_lock(netdb_lock);
  713. #endif
  714. return ret;
  715. +#endif
  716. }
  717.  
  718. PyDoc_STRVAR(gethostbyaddr_doc,
  719. @@ -3292,18 +3254,8 @@
  720. static PyObject *
  721. socket_getservbyname(PyObject *self, PyObject *args)
  722. {
  723. - char *name, *proto=NULL;
  724. - struct servent *sp;
  725. - if (!PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto))
  726. - return NULL;
  727. - Py_BEGIN_ALLOW_THREADS
  728. - sp = getservbyname(name, proto);
  729. - Py_END_ALLOW_THREADS
  730. - if (sp == NULL) {
  731. - PyErr_SetString(socket_error, "service/proto not found");
  732. - return NULL;
  733. - }
  734. - return PyInt_FromLong((long) ntohs(sp->s_port));
  735. + PyErr_SetString(socket_error, "getservbyname not implemented");
  736. + return NULL;
  737. }
  738.  
  739. PyDoc_STRVAR(getservbyname_doc,
  740. @@ -3322,19 +3274,8 @@
  741. static PyObject *
  742. socket_getservbyport(PyObject *self, PyObject *args)
  743. {
  744. - unsigned short port;
  745. - char *proto=NULL;
  746. - struct servent *sp;
  747. - if (!PyArg_ParseTuple(args, "H|s:getservbyport", &port, &proto))
  748. - return NULL;
  749. - Py_BEGIN_ALLOW_THREADS
  750. - sp = getservbyport(htons(port), proto);
  751. - Py_END_ALLOW_THREADS
  752. - if (sp == NULL) {
  753. - PyErr_SetString(socket_error, "port/proto not found");
  754. - return NULL;
  755. - }
  756. - return PyString_FromString(sp->s_name);
  757. + PyErr_SetString(socket_error, "getservbyport not implemented");
  758. + return NULL;
  759. }
  760.  
  761. PyDoc_STRVAR(getservbyport_doc,
  762. @@ -3352,6 +3293,9 @@
  763. static PyObject *
  764. socket_getprotobyname(PyObject *self, PyObject *args)
  765. {
  766. + PyErr_SetString(socket_error, "getprotobyname not supported");
  767. + return NULL;
  768. +#if 0
  769. char *name;
  770. struct protoent *sp;
  771. #ifdef __BEOS__
  772. @@ -3370,6 +3314,7 @@
  773. }
  774. return PyInt_FromLong((long) sp->p_proto);
  775. #endif
  776. +#endif
  777. }
  778.  
  779. PyDoc_STRVAR(getprotobyname_doc,
  780. @@ -4443,7 +4388,9 @@
  781. #ifndef __BEOS__
  782. /* We have incomplete socket support. */
  783. PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
  784. +#if 0
  785. PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
  786. +#endif
  787. #if defined(SOCK_RDM)
  788. PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
  789. #endif
  790. diff -ruN raw/Python-2.5.2/Modules/socketmodule.h Python-2.5.2/Modules/socketmodule.h
  791. --- raw/Python-2.5.2/Modules/socketmodule.h 2006-12-03 06:24:00.000000000 -0500
  792. +++ Python-2.5.2/Modules/socketmodule.h 2008-06-07 15:13:00.000000000 -0400
  793. @@ -1,31 +1,9 @@
  794. /* Socket module header file */
  795.  
  796. /* Includes needed for the sockaddr_* symbols below */
  797. -#ifndef MS_WINDOWS
  798. -#ifdef __VMS
  799. -# include <socket.h>
  800. -# else
  801. -# include <sys/socket.h>
  802. -# endif
  803. -# include <netinet/in.h>
  804. -# if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
  805. -# include <netinet/tcp.h>
  806. -# endif
  807. -
  808. -#else /* MS_WINDOWS */
  809. -#if _MSC_VER >= 1300
  810. -# include <winsock2.h>
  811. -# include <ws2tcpip.h>
  812. -# define HAVE_ADDRINFO
  813. -# define HAVE_SOCKADDR_STORAGE
  814. -# define HAVE_GETADDRINFO
  815. -# define HAVE_GETNAMEINFO
  816. -# define ENABLE_IPV6
  817. -#else
  818. -# include <winsock.h>
  819. -#endif
  820. -#endif
  821.  
  822. +#include <network.h>
  823. +#define NO_DUP
  824. #ifdef HAVE_SYS_UN_H
  825. # include <sys/un.h>
  826. #else
  827.  
  828. diff -ruN raw/Python-2.5.2/Tools/freeze/freeze.py Python-2.5.2/Tools/freeze/freeze.py
  829. --- raw/Python-2.5.2/Tools/freeze/freeze.py 2004-07-18 02:16:08.000000000 -0400
  830. +++ Python-2.5.2/Tools/freeze/freeze.py 2008-06-07 21:17:30.000000000 -0400
  831. @@ -114,7 +114,7 @@
  832. extensions = []
  833. exclude = [] # settable with -x option
  834. addn_link = [] # settable with -l, but only honored under Windows.
  835. - path = sys.path[:]
  836. + path = [] #sys.path[:]
  837. modargs = 0
  838. debug = 1
  839. odir = ''
  840. @@ -123,6 +123,7 @@
  841. error_if_any_missing = 0
  842.  
  843. # default the exclude list for each platform
  844. + exclude = exclude + ['errno', 'posix', 'pwd', 'thread']
  845. if win: exclude = exclude + [
  846. 'dos', 'dospath', 'mac', 'macpath', 'macfs', 'MACFS', 'posix',
  847. 'os2', 'ce', 'riscos', 'riscosenviron', 'riscospath',
  848. @@ -224,9 +225,10 @@
  849. if ishome:
  850. print "(Using Python source directory)"
  851. binlib = exec_prefix
  852. + path.append(os.path.join(prefix, 'Lib'))
  853. incldir = os.path.join(prefix, 'Include')
  854. config_h_dir = exec_prefix
  855. - config_c_in = os.path.join(prefix, 'Modules', 'config.c.in')
  856. + config_c_in = os.path.join(prefix, 'Modules', 'config.c')
  857. frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c')
  858. makefile_in = os.path.join(exec_prefix, 'Makefile')
  859. if win:
  860. @@ -341,7 +343,7 @@
  861.  
  862. # collect all modules of the program
  863. dir = os.path.dirname(scriptfile)
  864. - path[0] = dir
  865. + path.append(dir)
  866. mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths)
  867.  
  868. if win and subsystem=='service':
  869. diff -ruN raw/Python-2.5.2/Tools/freeze/hello.py Python-2.5.2/Tools/freeze/hello.py
  870. --- raw/Python-2.5.2/Tools/freeze/hello.py 1999-02-16 18:05:46.000000000 -0500
  871. +++ Python-2.5.2/Tools/freeze/hello.py 2008-06-06 22:56:43.000000000 -0400
  872. @@ -1 +1,11 @@
  873. -print 'Hello world...'
  874. +import ogc, video
  875. +xfb = ogc.Init()
  876. +import sys
  877. +sys.path = ['/']
  878. +print 'Running "run.py"...'
  879. +import run
  880. +
  881. +print 'Returning to the menu...'
  882. +
  883. +for i in range(60*5):
  884. + video.WaitVSync()
  885. diff -ruN raw/Python-2.5.2/Tools/freeze/makefreeze.py Python-2.5.2/Tools/freeze/makefreeze.py
  886. --- raw/Python-2.5.2/Tools/freeze/makefreeze.py 2004-07-18 02:16:08.000000000 -0400
  887. +++ Python-2.5.2/Tools/freeze/makefreeze.py 2008-06-07 20:12:42.000000000 -0400
  888. @@ -16,9 +16,56 @@
  889.  
  890. # if __debug__ == 0 (i.e. -O option given), set Py_OptimizeFlag in frozen app.
  891. default_entry_point = """
  892. -int
  893. -main(int argc, char **argv)
  894. -{
  895. +#include <stdio.h>
  896. +#include <stdlib.h>
  897. +#include <gccore.h>
  898. +
  899. +
  900. +static void *xfb = NULL;
  901. +static GXRModeObj *rmode = NULL;
  902. +
  903. +//---------------------------------------------------------------------------------
  904. +int main(int argc, char **argv) {
  905. +//---------------------------------------------------------------------------------
  906. +
  907. + // Initialise the video system
  908. + VIDEO_Init();
  909. +
  910. + // Obtain the preferred video mode from the system
  911. + // This will correspond to the settings in the Wii menu
  912. + rmode = VIDEO_GetPreferredMode(NULL);
  913. +
  914. + // Allocate memory for the display in the uncached region
  915. + xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
  916. +
  917. + // Initialise the console, required for printf
  918. + console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
  919. +
  920. + // Set up the video registers with the chosen mode
  921. + VIDEO_Configure(rmode);
  922. +
  923. + // Tell the video hardware where our display memory is
  924. + VIDEO_SetNextFramebuffer(xfb);
  925. +
  926. + // Make the display visible
  927. + VIDEO_SetBlack(FALSE);
  928. +
  929. + // Flush the video register changes to the hardware
  930. + VIDEO_Flush();
  931. +
  932. + // Wait for Video setup to complete
  933. + VIDEO_WaitVSync();
  934. + if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
  935. +
  936. +
  937. + // The console understands VT terminal escape codes
  938. + // This positions the cursor on row 2, column 0
  939. + // we can use variables for this with format codes too
  940. + // e.g. printf ("\x1b[%d;%dH", row, column );
  941. +
  942. +
  943. + printf("Starting Python...\\n");
  944. +
  945. extern int Py_FrozenMain(int, char **);
  946. """ + ((not __debug__ and """
  947. Py_OptimizeFlag++;
Add Comment
Please, Sign In to add comment