2016-12-28 1 views

答えて

1

バージョン番号を自動的にインクリメントするためのスフィンク固有の方法はありません。しかし、conf.pyはpythonファイルであるため、conf.pyに含まれる小さな関数を実装することができます。この関数は、不揮発性メモリ(例えばjsonファイル)からバージョンを読み込み、日付テーブルを出力し、 -揮発性メモリ。おそらくこのようになります(jsonのコンテンツが[12,7,1,0]の場合):

# Read the version number from conf.json 
fp = open('conf.json', 'r') 
rev = json.load(fp) # rev = [12,7,1,0] 
fp.close 

# The version info for the project you're documenting, acts as replacement for 
# |version| and |release|, also used in various other places throughout the 
# built documents. 
# 

# The short X.Y version. 
version = '{}.{}'.format(rev[0], rev[1]) # version = "12.7" 

# The full version, including alpha/beta/rc tags. 
release = '{}.{}.{}.{}'.format(*rev) # release = "12.7.1.0" 

# Write the incremented version number to conf.json 
fp = open ('conf.json', 'w') 
rev[0] += 1 
json.dump(rev, fp) 
fp.close() 
関連する問題