Skip to content

Instantly share code, notes, and snippets.

View jun66j5's full-sized avatar
💬

Jun Omae (大前 潤) jun66j5

💬
  • OpenGroove,Inc.
  • Tokyo, Japan
View GitHub Profile
@jun66j5
jun66j5 / rcsfile-replace-private-data.py
Created November 25, 2021 23:37
Replace private data in RCS file
#! /usr/bin/python
import os
import re
import sys
_rcsdiff_re = re.compile(r"""
\n
([^\n]+)\n
diff --git a/build/run_tests.py b/build/run_tests.py
index 7ae07806b..d6cf417e1 100755
--- a/build/run_tests.py
+++ b/build/run_tests.py
@@ -91,6 +91,26 @@ class TextColors:
cls.SUCCESS = ''
+if hasattr(subprocess.Popen, '__enter__'):
+ Popen = subprocess.Popen
javascript:(function(b,k,e,l,s) { b = document.body; k = new Set(); e = function(event) { var m = /^\w[\w\d]*/.exec(event.target.textContent); if (m) b.className += ' x-highlight-' + m[0]; }; l = function(event) { var m = /^\w[\w\d]*/.exec(event.target.textContent); if (m) b.className = b.className.replace(' x-highlight-' + m[0], ''); }; document.querySelectorAll('dl em, dl span.pre').forEach(function(node) { var m = /^\w[\w\d]*/.exec(node.textContent); if (m) { node.className += ' x-highlight-' + m[0]; node.addEventListener('mouseenter', e); node.addEventListener('mouseleave', l); k.add(m[0]); } }); s = document.createElement('style'); k = Array.from(k.keys()); s.textContent = k.map(v => 'body.@ .@'.replace(/@/g, 'x-highlight-' + v)) .join(', ') + ' { background-color: lightgreen }'; b.appendChild(s); })()
@jun66j5
jun66j5 / patterns of apr_pool_t arguments
Last active May 26, 2020 05:51
swig-py apis with multiple apr_pool_t arguments
apr_pool_t pool
apr_pool_t result
apr_pool_t result_pool
apr_pool_t scratch_pool
apr_pool_t node_pool, apr_pool_t pool
apr_pool_t result_pool, apr_pool_t scratch_pool
Handle correctly multiple apr_pool_t * arguments of function in Python
bindings to fix negative ref count of _global_py_pool object.
* subversion/bindings/swig/include/svn_types.swg
(%typemap(default) apr_pool_t *): Retrieve apr_pool_t * pointer from args
parameter only when _global_pool is NULL in order to increase correctly ref
count.
(%typemap(in) apr_pool_t *): Retrieve apr_pool_t * pointer from the Python
object when an argument is not the last apr_pool_t * argument.
(%typemap(freearg) apr_pool_t *): Decreament ref count of Python object only
Index: subversion/bindings/swig/core.i
===================================================================
--- subversion/bindings/swig/core.i (revision 1877480)
+++ subversion/bindings/swig/core.i (working copy)
@@ -23,8 +23,10 @@
* of the more specific module files.
*/
+%include svn_module.swg
+
* build/run_tests.py
(open_logfile): New function returning file-like object which is reassignable
sys.stdout and sys.stderr.
(TestHarness.run): Use open_logfile() instead of codecs.open().
(TestHarness._open_log): Ditto.
(TestHarness._run_py_test): Reassign sys.stdout and sys.stderr instead of
uses of os.dup2().
* subversion/tests/cmdline/svntest/main.py
(LoggingStdoutHandler): New function to use the value of sys.stdout at call
@jun66j5
jun66j5 / build.cmd
Created April 23, 2020 18:41
Build script for Subversion on Windows x64
@REM
@REM Top-directory/
@REM httpd/ .... Apache Lounge Distribution / Apache 2.4.x win64 VS16
@REM Apache24/
@REM include/
@REM expat_external.h .... https://github.com/libexpat/libexpat/raw/R_2_2_9/expat/lib/expat_external.h
@REM py3c/ .... https://github.com/encukou/py3c
@REM include/
@REM py3c.pc.in
@REM sqlite/ .... SQLite amalgamation
START: auth-test.exe
PASS: auth-test 1: test retrieving platform-specific auth providers
PASS: auth-test 2: test svn_auth_clear()
PASS: auth-test 3: test save cleartext info
END: auth-test.exe
ELAPSED: auth-test.exe 0:00:00.110202
START: authz-test.exe
Access check for ('wunga', 'bloop')
Global rights: min=r, max=rw (explicit)
# -*- coding: utf-8 -*-
import re
import sys
from email.header import Header, decode_header
from email.Charset import Charset, QP
MAX_LENGTH = 76