1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#!/usr/bin/env python3
import os
from os import path
import glob
def sort_files(files):
return sorted(files, key=lambda v: v.lower())
def get_files(basedir):
return_files = []
entries = os.listdir(basedir)
files = sort_files(
filter(
lambda x: path.isfile(path.join(basedir, x)) and not x.endswith('.pyc'),
entries
),
)
dirs = sort_files(
filter(
lambda x: path.isdir(path.join(basedir, x)) and
(x != '__pycache__' or
'.gitkeep' in os.listdir(path.join(basedir, x))),
entries,
)
)
for dir in dirs:
return_files += get_files(path.join(basedir, dir))
return_files += [path.join(basedir, f) for f in files]
return return_files
manifest_list = []
manifest_list += get_files('asciidoc')
doc_glob = [
'doc/*.1',
'doc/*.txt',
]
doc_files = [
'doc/article-docinfo.xml',
'doc/asciidoc.conf',
'doc/asciidoc.dict',
'doc/customers.csv',
]
for entry in doc_glob:
doc_files += glob.glob(entry)
manifest_list += sort_files(doc_files)
manifest_list += sort_files(glob.glob('images/*'))
manifest_list += get_files('tests')
manifest_list += sort_files([
'BUGS.adoc',
'build_manifest.py',
'CHANGELOG.adoc',
'configure.ac',
'COPYRIGHT',
'Dockerfile',
'install-sh',
'INSTALL.adoc',
'LICENSE',
'Makefile.in',
'MANIFEST',
'MANIFEST.in',
'README.md',
'setup.py',
])
with open('MANIFEST', 'w') as open_file:
open_file.write("\n".join(manifest_list) + "\n")
|