Skip to content

Commit

Permalink
preview support
Browse files Browse the repository at this point in the history
  • Loading branch information
flowdas committed May 7, 2018
1 parent 14788bd commit df66209
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/cpython
/venv
23 changes: 23 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
파이썬 한국어 번역
==========================

파이썬 안정판만을 번역하고, 현재는 3.6 입니다. 번역은 3.6 브랜치에 들어있고, master 브랜치에는 번역 작업을 보조하는 도구들이 들어있습니다.

번역팀에 문의가 있으신 분들은 http://www.flowdas.com/pages/python-docs-ko.html 를 참고 바랍니다.

교정을 위한 프리뷰 빌드하기
---------------------------------------

저장소를 fork 한 후에 git clone 하면 master 브랜치의 작업 사본이 만들어집니다. 이 디렉토리에서 다음과 같은 명령을 실행합니다.

::

python3 -m venv venv
venv/bin/python -m pip install -r requirements.txt
./build.py

이제 ``cpython/Doc/build/html/index.html`` 에 프리뷰 파일이 만들어집니다.

한편 ``cpython/locale/ko/LC_MESSAGES`` 디렉토리에는 여러분이 fork 한 저장소의 3.6 브랜치의 작업 사본이 만들어집니다.

이제 ``cpython/locale/ko/LC_MESSAGES`` 디렉토리의 파일들을 번역한 후에, ``./build.py`` 를 실행하면 프리뷰가 업데이트 됩니다.
57 changes: 57 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
import os
import subprocess

VERSION = '3.6'


def shell(cmd, capture=False, chdir=None):
opts = {
'shell': True,
'stdin': subprocess.PIPE,
}
cwd = os.getcwd() if chdir else None
if chdir:
os.chdir(chdir)
try:
if capture:
opts['stderr'] = subprocess.STDOUT
opts['universal_newlines'] = True
return subprocess.check_output(cmd, **opts)
else:
return subprocess.check_call(cmd, **opts)
finally:
if cwd:
os.chdir(cwd)


def git_clone(repository, directory, branch=None):
shell("git clone --depth 1 --no-single-branch {} {}".format(repository, directory))
if branch:
shell("git -C {} checkout {}".format(directory, branch))


def prepare_env():
if not os.path.exists('cpython'):
git_clone('[email protected]:python/cpython.git', 'cpython', VERSION)

locale_dir = os.path.join('cpython', 'locale', 'ko', 'LC_MESSAGES')
if not os.path.exists(locale_dir):
locale_repo = shell('git config --get remote.origin.url', capture=True).strip()
git_clone(locale_repo, locale_dir, VERSION)


def build():
doc_dir = os.path.join('cpython', 'Doc')
shell(
"make VENVDIR=../../venv SPHINXOPTS='-D locale_dirs=../locale -D language=ko -D gettext_compact=0' autobuild-stable-html",
chdir=doc_dir)


def main():
prepare_env()
build()


if __name__ == '__main__':
main()
22 changes: 22 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
alabaster==0.7.10
Babel==2.4.0
certifi==2018.1.18
chardet==3.0.4
docutils==0.14
idna==2.6
imagesize==1.0.0
Jinja2==2.10
MarkupSafe==1.0
Pygments==2.2.0
pyparsing==2.2.0
pytz==2018.4
requests==2.18.4
six==1.11.0
snowballstemmer==1.2.1
Sphinx==1.7.4
sphinx-rtd-theme==0.3.0
blurb==1.0.6
sphinxcontrib-websupport==1.0.1
typing==3.6.1
urllib3==1.22
python-docs-theme==0.0.1

0 comments on commit df66209

Please sign in to comment.