本文を読み飛ばす

msys: minttyをtmuxで起動する

mintty起動してからtmuxを毎回起動するのが面倒になってきたので msysの起動スクリプト( msys2_shell.cmd )を改変してみます。

最初に msys2_shell.cmd をコピーして msys2_tmux.cmd という名前にしました。 これを個人のhomeフォルダに置きました (version管理したかったので)

改変ポイント1(optional):

@echo off
setlocal

set "WD=%__CD__%"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=%~dp0usr\bin\"
if NOT EXIST "%WD%msys-2.0.dll" set "WD=c:\app\msys64\usr\bin\"

改変ポイント2:

:startsh
rem 7. work fine
start "%CONTITLE%" "%WD%mintty" -c "c:\Users\shinji\.minttyrc" -i /msys2.ico /usr/bin/tmux.exe -f "%USERPROFILE%\.tmux.conf" -c "/usr/bin/bash --login"
goto startsh_end

:startsh_end
exit /b %ERRORLEVEL%

改変ポイント3 ショートカットはこんな感じで書きます

command:

cmd /c c:pathtomsys2_tmux.cmd -here

work directory:

起動したいディレクトリ。私は c:\src と書きました。

続きを読む…

vim: statusline

手持ちの環境で最近 column がstatuslineに出力されていなかった。

なんで消えてたかは不明でしたが...

ここを参考に調整

結果はこんな感じ:

set statusline=%F%m%r%h%w\%=[T:%Y,%{&ff},%{&fenc}]%l/%L,%2v

utf-8とかunixとかは、頭文字や略称だけにしたいなーとか考えたけど...

スクリプト組めばいけそうではあるな...

続きを読む…

msys: sudo/ lnを使う

Windowsの運用で気になることがまた2つ。

  1. sudoがしたい

  2. lnが普通のコピーで運用される。

これらが使いにくい。

lnは実行してリンクと思ってたら 実際には実体が別になってましたー、とか、ちょっと混乱します。

sudoはどうなんだろう、ln以外には使わないけど...

続きを読む…

Sotec E-Note ノートPC(3台目)

  • 2009/01 貰う

スペック思い出せないわ...

母がどこかのおじさんから譲ってもらったらしい

CPU AMD K6-II?
Mem 64MB 買い替え 1000円
Storage ??GB HDD
Keyboard ふつう
Weight ???g
Monitor 10" (800x600?)
Battery ????mAh
I/F 1 USB x3

本文なし

PY4A: いろいろ

PY4A: Numpy をビルド

PyCrypto と同様のMakefileを作って、 compile OK でした。

ただ、 user base は、FATには置けなさそう。 .so の読み込みができません。 /data/local/tmp/local にコピーすれば読み込めました。

PY4A: PyCrypto をビルド

PEP452 って知らなかったです。 py4a の pyver と abi は間違っているみたいです。

次のリリースぐらいには直そうかな

さて、 pycrypto を cross compile してみました。

  • ファイル名の扱いで苦労しました

  • wheel (pip) の platform チェックを調べました

  • pycrypto の実機確認をしました。(簡単な例のみ)

  • スクリプトに落とし込んで完了

wheel (pip) の platform チェックを調べる

import re

wheel_file_re = re.compile(
        r"""^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))
        ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
        \.whl|\.dist-info)$""",
        re.VERBOSE
    )
for i in ("pycrypto-2.6.1-cp36-cp36m-arm_linux_androideabi.whl",
          "pycrypto-2.6.1-cpython-36m-arm_linux_androideabi.whl",
          ):
    info = wheel_file_re.match(i)
    print(info.group("ver"),
          info.group("pyver"),
          info.group("abi"),
          info.group("plat"))

>>> 2.6.1 cp36 cp36m arm_linux_androideabi
>>> 2.6.1 cpython 36m arm_linux_androideabi

n7000 ~ # bash python3.sh
Python 3.6.0 (default, Mar  5 2017, 14:39:55)
[GCC 4.9 20140827 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from wheel import pep425tags
>>> pep425tags.supported_tags
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'wheel.pep425tags' has no attribute 'supported_tags'
>>> pep425tags.supported_tags
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'wheel.pep425tags' has no attribute 'supported_tags'
>>> from pip import pep425tags as a
WARNING:root:cert file changed, android system have no-compatibles with python:/mnt/sdcard/com.googlecode.python3forandroid/cacert.pem
>>> a.supported_tags
[('cp36', 'cp36m', 'linux_armv7l'), ('cp36', 'abi3', 'linux_armv7l'), ('cp36', 'none', 'linux_armv7l'), ('cp35', 'abi3', 'linux_armv7l'), ('cp34', 'abi3', 'linux_armv7l'), ('cp33', 'abi3', 'linux_armv7l'), ('cp32', 'abi3', 'linux_armv7l'), ('py3', 'none', 'linux_armv7l'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

出力を見ると linux_armv7l となってますね。

ファイル名を変更して install を実効してみます。:

n7000 ~ # bash python3.sh sl4a/scripts/pip_console.py install wheel
WARNING:root:cert file changed, android system have no-compatibles with python:/mnt/sdcard/com.googlecode.python3forandroid/cacert.pem
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |################################| 71kB 177kB/s
Installing collected packages: wheel
Successfully installed wheel-0.29.0
n7000 ~ # bash python3.sh sl4a/scripts/pip_console.py install pycrypto-2.6.1-cp36-cp36m-linux_armv7l.whl
WARNING:root:cert file changed, android system have no-compatibles with python:/mnt/sdcard/com.googlecode.python3forandroid/cacert.pem
Processing ./pycrypto-2.6.1-cp36-cp36m-linux_armv7l.whl
Installing collected packages: pycrypto
Successfully installed pycrypto-2.6.1

使えるかどうかテスト

n7000 ~ # bash python3.sh
Python 3.6.0 (default, Mar  5 2017, 14:39:55)
[GCC 4.9 20140827 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Hash import SHA256
>>> SHA256.new('abc'.encode("latin-1")).hexdigest()
'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad'

[Makefile](https://github.com/kuri65536/python-for-android/python-modules/PyCrypto/Makefile) に落とし込んで完了 [#130](https://github.com/kuri65536/python-for-android/issues/130)

続きを読む…

宣伝: