summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Peveler <matt.peveler@gmail.com>2022-02-23 16:06:36 -0500
committerGitHub <noreply@github.com>2022-02-23 16:06:36 -0500
commite27a86e486077626c0e14f1fdd159dad7540ced2 (patch)
tree0f785ca90d335247a0c23615da034ab51342e9bd
parentfcfeb03e7e9bfc8e0fa30f9452e66d7b4c26e5e4 (diff)
downloadasciidoc-py3-e27a86e486077626c0e14f1fdd159dad7540ced2.tar.gz
Fix distribution missing test_data directory (#244)
-rw-r--r--.github/workflows/test.yml58
-rw-r--r--Makefile.in4
-rw-r--r--build_manifest.py79
-rw-r--r--build_manifest.sh41
4 files changed, 139 insertions, 43 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cc62eca..4599f56 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -136,3 +136,61 @@ jobs:
- run: asciidoc --version
- run: asciidoc --filter list
+
+ make-dist:
+ needs: lint
+ runs-on: ubuntu-latest
+ env:
+ python-version: 3.5
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python ${{ env.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install apt dependencies
+ run: |
+ sudo apt-get install -y --no-install-recommends \
+ docbook-xml \
+ docbook-xsl \
+ dvipng \
+ dvisvgm \
+ graphviz \
+ imagemagick \
+ libxml2-utils \
+ lilypond \
+ source-highlight \
+ texlive-latex-base \
+ xsltproc
+
+ - run: pip install -U pytest pytest-mock
+
+ - name: Configure make
+ run: |
+ autoconf
+ ./configure
+
+ - run: make dist
+
+ - run: mkdir dist
+
+ - run: tar -xvf build/asciidoc-*.tar.gz -C dist --strip-components=1
+
+ - run: |
+ autoconf
+ ./configure
+ working-directory: dist
+
+ - run: python3 -m pytest
+ working-directory: dist
+
+ - run: python3 tests/testasciidoc.py run --number 1
+ working-directory: dist
+
+ - run: make install
+ working-directory: dist
+
+ - run: asciidoc --version
diff --git a/Makefile.in b/Makefile.in
index 7f3ac3c..35861db 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -120,8 +120,8 @@ uninstall:
clean:
rm -f $(manp)
-MANIFEST: MANIFEST.in build_manifest.sh
- bash build_manifest.sh
+MANIFEST: build_manifest.py
+ python3 build_manifest.py
##.
## dist: creates the zip and tarball for release
diff --git a/build_manifest.py b/build_manifest.py
new file mode 100644
index 0000000..7464d9b
--- /dev/null
+++ b/build_manifest.py
@@ -0,0 +1,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")
diff --git a/build_manifest.sh b/build_manifest.sh
deleted file mode 100644
index 7824378..0000000
--- a/build_manifest.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-
-cat > MANIFEST.tmp <<- EOM
-asciidoc/*.py
-asciidoc/**/*.py
-asciidoc/resources/**/*
-asciidoc/resources/*.conf
-doc/asciidoc.conf
-doc/article-docinfo.xml
-doc/customers.csv
-doc/*.1
-doc/*.txt
-doc/asciidoc.dict
-images/*
-tests/data/*
-tests/inputs/*
-tests/*.py
-tests/testasciidoc.conf
-*.sh
-BUGS.adoc
-CHANGELOG.adoc
-configure.ac
-COPYRIGHT
-Dockerfile
-install-sh
-INSTALL.adoc
-LICENSE
-MANIFEST.in
-Makefile.in
-README.md
-setup.py
-EOM
-
-rm -f MANIFEST
-while read in; do
- if [ ! -z "${in}" ]; then
- ls -1Ad ${in} | grep -v ".pyc" | grep -v "__pycache__" >> MANIFEST
- fi
-done < MANIFEST.tmp
-echo "MANIFEST" >> MANIFEST
-rm -f MANIFEST.tmp