From b3e0d7c0fd2fe4b3ace6098f3af35ef09e477745 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sat, 23 Mar 2024 17:23:18 +0000 Subject: [PATCH] Use Meson to build and install Copy fract4dc instead of linking else pylint fails on GitHub. --- .github/workflows/test-gnofract4d.yml | 22 ++- README.md | 13 +- _conf_data.py.in | 2 + bin/build.sh | 6 +- docker/bin/run_builds.sh | 5 +- docker/bin/run_clean.sh | 3 +- docker/bin/run_pylint.sh | 5 +- docker/bin/run_test.sh | 3 +- docker/bin/run_tox.sh | 5 +- examples/README.md | 3 +- fract4d/c/meson.build | 55 ++++++ fract4d/fractconfig.py | 9 +- fract4d/options.py | 6 +- gnofract4d | 5 +- meson.build | 157 +++++++++++++++++ meson_options.txt | 1 + setup.cfg | 4 - setup.py | 236 -------------------------- test.py | 20 --- 19 files changed, 263 insertions(+), 297 deletions(-) create mode 100644 _conf_data.py.in create mode 100644 fract4d/c/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt delete mode 100644 setup.cfg delete mode 100755 setup.py diff --git a/.github/workflows/test-gnofract4d.yml b/.github/workflows/test-gnofract4d.yml index 467ab38f3..f5f282fc5 100644 --- a/.github/workflows/test-gnofract4d.yml +++ b/.github/workflows/test-gnofract4d.yml @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v3 - name: Install macOS packages if: ${{ runner.os == 'macOS' }} - run: brew install gtk4 pygobject3 + run: brew install gtk4 ninja pygobject3 # Prevent delay caused by: # `brew cleanup` has not been run in 30 days, running now... env: @@ -43,16 +43,18 @@ jobs: # libxml2-utils provides xmllint for xml-stripblanks in gresource.xml run: | sudo apt update - sudo apt install dbus-x11 gir1.2-gtk-4.0 gvfs libgirepository1.0-dev libxml2-utils xvfb + sudo apt install dbus-x11 gir1.2-gtk-4.0 gvfs libgirepository1.0-dev libxml2-utils ninja-build xvfb - name: Setup Python uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - name: Install Tox and any other PyPI packages - run: pip install tox + run: pip install meson pytest tox - name: Build - run: python setup.py build - - name: Run Tox (macOS) + run: | + meson setup _build + meson compile -C _build + - name: Run Tox (MacOS) if: ${{ runner.os == 'macOS' }} run: tox -e ${{ matrix.toxenv }} - name: Run Tox (Linux) @@ -79,10 +81,12 @@ jobs: # libglib2.0-dev-bin provides glib-compile-resources run: | sudo apt update - sudo apt install gir1.2-gtk-4.0 libglib2.0-dev-bin libxml2-utils python3-gi - - name: Install Tox - run: pip install tox + sudo apt install gir1.2-gtk-4.0 libglib2.0-dev-bin libxml2-utils ninja-build python3-gi + - name: Install Tox and any other PyPI packages + run: pip install meson pytest tox - name: Build - run: python setup.py build + run: | + meson setup _build + meson compile -C _build - name: Run ${{ matrix.toxenv }} run: tox -e ${{ matrix.toxenv }} diff --git a/README.md b/README.md index 0a59a7043..886dc5f90 100644 --- a/README.md +++ b/README.md @@ -14,15 +14,16 @@ Basic Installation Run: - ./setup.py build + meson setup --prefix ~/.local/ _build + meson compile -C _build You can then run Gnofract 4D in the local directory: ./gnofract4d -Alternatively to build and install Gnofract 4D type: +Alternatively to install Gnofract 4D type: - pip3 install gnofract4d-4.3.tar.gz + meson install -C _build You can then run it by clicking on the desktop icon or typing: @@ -44,22 +45,22 @@ On Debian/Ubuntu, these can be installed with: To build from source you also need: +- Meson and Ninja - A C++ compiler - headers for libpng and libjpeg - Python headers - glib-compile-resources and optionally xmllint - pkg-config -- Python setuptools package On Debian/Ubuntu, these can be installed with: - sudo apt install build-essential libglib2.0-dev-bin libjpeg-dev libpng-dev libpython3-dev libxml2-utils pkg-config python3-setuptools + sudo apt install build-essential libglib2.0-dev-bin libjpeg-dev libpng-dev libpython3-dev libxml2-utils meson pkg-config If FFmpeg is installed it will be possible to create videos. On macOS, you can install the dependencies using brew: - brew install librsvg python3 pkg-config gtk4 pygobject3 libpng jpeg + brew install librsvg meson python3 pkg-config gtk4 pygobject3 libpng jpeg Testing ======= diff --git a/_conf_data.py.in b/_conf_data.py.in new file mode 100644 index 000000000..664445a17 --- /dev/null +++ b/_conf_data.py.in @@ -0,0 +1,2 @@ +APP_DATADIR = "@app_datadir@" +VERSION = "@version@" diff --git a/bin/build.sh b/bin/build.sh index fbfdd334d..8ec5fe2a3 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -rm -rf build -rm fract4d/*.so -./setup.py build +rm -rf _build +meson setup --prefix ~/.local/ _build +meson compile -C _build diff --git a/docker/bin/run_builds.sh b/docker/bin/run_builds.sh index 0643c1033..2f316b7c1 100755 --- a/docker/bin/run_builds.sh +++ b/docker/bin/run_builds.sh @@ -2,7 +2,6 @@ docker-compose up -d --build docker-compose exec server bash -c "rm -rf build" -docker-compose exec server bash -c "python3.6 ./setup.py build && \ - python3.7 ./setup.py build && \ - python3.8 ./setup.py build" +docker-compose exec server bash -c "meson setup --prefix ~/.local/ _build && \ + meson compile -C _build" docker-compose down diff --git a/docker/bin/run_clean.sh b/docker/bin/run_clean.sh index b5028b37d..4dd6e35e9 100755 --- a/docker/bin/run_clean.sh +++ b/docker/bin/run_clean.sh @@ -1,8 +1,7 @@ #!/bin/bash docker-compose up -d -docker-compose exec server bash -c "rm -rf build && \ - rm fract4d/*.so && \ +docker-compose exec server bash -c "rm -rf _build && \ rm -rf .pytest_cache && \ rm -rf .tox" docker-compose down diff --git a/docker/bin/run_pylint.sh b/docker/bin/run_pylint.sh index faae49121..5c2f12439 100755 --- a/docker/bin/run_pylint.sh +++ b/docker/bin/run_pylint.sh @@ -1,7 +1,8 @@ #!/bin/bash docker-compose up -d --build -docker-compose exec server bash -c "rm -rf build" -docker-compose exec server bash -c "python3 setup.py build && \ +docker-compose exec server bash -c "rm -rf _build" +docker-compose exec server bash -c "meson setup --prefix ~/.local/ _build && \ + meson compile -C _build && \ ./bin/pylint.sh" docker-compose down diff --git a/docker/bin/run_test.sh b/docker/bin/run_test.sh index e914c6231..b41911a4d 100755 --- a/docker/bin/run_test.sh +++ b/docker/bin/run_test.sh @@ -2,6 +2,7 @@ docker-compose up -d --build docker-compose exec server bash -c "rm -rf build" -docker-compose exec server bash -c "python3 setup.py build && \ +docker-compose exec server bash -c "meson setup --prefix ~/.local/ _build && \ + meson compile -C _build && \ pytest fract4d fract4dgui fract4d_compiler test.py" docker-compose down diff --git a/docker/bin/run_tox.sh b/docker/bin/run_tox.sh index 0b755cbe0..600b4b0e4 100755 --- a/docker/bin/run_tox.sh +++ b/docker/bin/run_tox.sh @@ -2,8 +2,7 @@ docker-compose up -d --build docker-compose exec server bash -c "rm -rf build" -docker-compose exec server bash -c "python3.6 ./setup.py build && \ - python3.7 ./setup.py build && \ - python3.8 ./setup.py build && \ +docker-compose exec server bash -c "meson setup --prefix ~/.local/ _build && \ + meson compile -C _build && \ tox" docker-compose down diff --git a/examples/README.md b/examples/README.md index 809844277..063b8c4b0 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,7 +2,8 @@ *Note: for all exmples make sure you have performed the setup previously:* ``` -./setup.py build +meson setup --prefix ~/.local/ _build +meson compile -C _build ``` ## Python examples diff --git a/fract4d/c/meson.build b/fract4d/c/meson.build new file mode 100644 index 000000000..66a4f7122 --- /dev/null +++ b/fract4d/c/meson.build @@ -0,0 +1,55 @@ +jpeg = dependency('libjpeg') +png = dependency('libpng') + +fract4dc = py.extension_module('fract4dc', + 'fract4dmodule.cpp', + 'fract_stdlib.cpp', + + 'fract4dc/colormaps.cpp', + 'fract4dc/loaders.cpp', + 'fract4dc/sites.cpp', + 'fract4dc/images.cpp', + 'fract4dc/calcs.cpp', + 'fract4dc/workers.cpp', + 'fract4dc/functions.cpp', + 'fract4dc/arenas.cpp', + 'fract4dc/utils.cpp', + 'fract4dc/calcargs.cpp', + 'fract4dc/pysite.cpp', + + 'fract4dc/controllers.cpp', + + 'model/calcfunc.cpp', + 'model/fractfunc.cpp', + 'model/site.cpp', + 'model/image.cpp', + 'model/imagewriter.cpp', + 'model/imagereader.cpp', + 'model/colormap.cpp', + 'model/worker.cpp', + 'model/STFractWorker.cpp', + 'model/MTFractWorker.cpp', + 'model/pointfunc.cpp', + 'model/stats.cpp', + 'model/colorutils.cpp', + 'model/imageutils.cpp', + + dependencies: [jpeg, png, py_dep], + include_directories: ['fract4dc', 'model'], + cpp_args: ['-DTHREADS=1', '-DPNG_ENABLED=1', '-DJPG_ENABLED=1'], + gnu_symbol_visibility: 'default', + install: true, + subdir: 'fract4d', +) + +install_headers( + 'fract_stdlib.h', + 'pf.h', + install_dir: py.get_install_dir() / 'fract4d/c', +) + +install_headers( + 'model/colorutils.h', + 'model/imageutils.h', + install_dir: py.get_install_dir() / 'fract4d/c/model', +) diff --git a/fract4d/fractconfig.py b/fract4d/fractconfig.py index ff9a9d250..6a931944b 100644 --- a/fract4d/fractconfig.py +++ b/fract4d/fractconfig.py @@ -3,6 +3,11 @@ import os import sys +try: + from ._conf_data import APP_DATADIR +except ImportError: + APP_DATADIR = ".." + CONFIG_FILE = "~/.gnofract4d" @@ -132,9 +137,7 @@ def ensure_contains(self, section, required_item): def get_data_path(subpath=""): # find where data files are present. # use share path one level up from module location - moduledir = os.path.dirname(sys.modules[__name__].__file__) - path = os.path.normpath(os.path.join( - moduledir, "../../../../share/gnofract4d", subpath)) + path = os.path.join(APP_DATADIR, subpath) #print("Looking in %s" % path) return path diff --git a/fract4d/options.py b/fract4d/options.py index 197da3104..e37024d04 100644 --- a/fract4d/options.py +++ b/fract4d/options.py @@ -4,8 +4,10 @@ import sys from . import fractal as fract4d_fractal -# version of Gnofract 4D -VERSION = '4.3' +try: + from ._conf_data import VERSION +except ImportError: + VERSION = "dev" POSITION_ARGUMENTS = ("xcenter", "ycenter", "zcenter", "wcenter", "xyangle", "xzangle", "xwangle", "yzangle", "ywangle", "zwangle", diff --git a/gnofract4d b/gnofract4d index 29d25c5d9..591c8bf7c 100755 --- a/gnofract4d +++ b/gnofract4d @@ -22,8 +22,9 @@ except ImportError as err: print(_("Can't import a required module.")) if "fract4dc" in str(err): print(_("If you haven't set up Gnofract 4D yet, run:\n" - "./setup.py build\n")) - print(_("Error was: '%s'") % err) + " meson setup _build\n" + " meson compile -C _build\n")) + print(_("Error was: '%s' ") % err) sys.exit(1) def main(args): diff --git a/meson.build b/meson.build new file mode 100644 index 000000000..28bdf38dd --- /dev/null +++ b/meson.build @@ -0,0 +1,157 @@ +project('gnofract4d', 'cpp', + license: 'BSD', + default_options: ['cpp_std=c++17', + 'buildtype=release', + 'warning_level=3', + 'b_ndebug=if-release', + 'b_lto=true', + 'strip=true', + ], + meson_version: '>= 0.56', + version: '4.3', +) + +project_datadir = get_option('datadir') / meson.project_name() +if get_option('docdir') != '' + project_docdir = get_option('docdir') +else + project_docdir = get_option('datadir') / 'doc/gnofract4d' +endif + +pymod = import('python') +py = pymod.find_installation() + +py_version = py.language_version() +if py_version.version_compare('< 3.6') + error('Sorry, you need Python 3.6 or higher to run Gnofract 4D.' + + ' You have version ' + py_version + '. Please upgrade.') +endif + +py_dep = py.dependency(required: true) + +gnome = import('gnome') +gresource = gnome.compile_resources('gnofract4d', 'fract4dgui/gnofract4d.gresource.xml', + source_dir: 'fract4dgui', + gresource_bundle: true, + install: true, + install_dir: project_datadir, +) + +install_data('gnofract4d', + install_dir: get_option('bindir'), +) + +subdir('fract4d/c') + +packages = ['fract4d', 'fract4d_compiler', 'fract4dgui'] +foreach p: packages + install_subdir(p, + install_dir: py.get_install_dir(), + exclude_directories: ['tests', 'builder', 'c', 'fract4d_new'], + exclude_files: ['gnofract4d.css', 'gnofract4d.gresource.xml'], + ) +endforeach + +conf_data = configuration_data() +conf_data.set('app_datadir', get_option('prefix') / project_datadir) +conf_data.set('version', meson.project_version()) +conf_file = configure_file(input: '_conf_data.py.in', + output: '_conf_data.py', + configuration: conf_data, + install: true, + install_dir: py.get_install_dir() / 'fract4d', +) + +# Application Data + +install_data(['LICENSE', 'README.md'], + install_dir: project_docdir, +) + +install_subdir('help', + exclude_directories: 'svg', + exclude_files: ['favicon.svg', 'flexsearch.min.js', 'index.xml', + 'manifest.json', 'mermaid.min.js', 'sitemap.xml'], + install_dir: project_datadir / 'help', + strip_directory: true, +) + +install_subdir('formulas', + install_dir: project_datadir, +) + +install_subdir('maps', + install_dir: project_datadir, +) + +# Desktop Environment Data + +install_data('pixmaps/logo/48x48/gnofract4d.png', + install_dir: 'share/pixmaps', +) + +icon_sizes = [16, 32, 48, 64, 128, 256] +icon_template = 'pixmaps/logo/@0@x@0@/gnofract4d.png' +icon_dir_template = '@0@x@0@/apps/gnofract4d.png' +icons = [] +icon_dirs = [] + +foreach s: icon_sizes + icons += icon_template.format(s) + icon_dirs += icon_dir_template.format(s) +endforeach + +install_data(icons, + rename: icon_dirs, + install_dir: 'share/icons/hicolor', +) + +install_data('io.github.fract4d.desktop', + install_dir: 'share/applications', +) + +install_data('gnofract4d-mime.xml', + install_dir: 'share/mime/packages', +) + +# Test + +cp = find_program('cp') +custom_target('cp_so', + command: [cp, + fract4dc.full_path(), + meson.project_source_root() / 'fract4d/', + ], + output: 'none1', + build_by_default: true, + depends: fract4dc, +) +custom_target('cp_gresource', + command: [cp, + gresource, + meson.project_source_root(), + ], + output: 'none2', + build_by_default: true, + depends: gresource, +) +custom_target('cp_confdata', + command: [cp, + conf_file, + meson.project_source_root() / 'fract4d/', + ], + output: 'none3', + build_by_default: true, +) + +test('testing', + find_program('pytest', required: false), + args: ['-v', + 'fract4d', + 'fract4dgui', + 'fract4d_compiler', + 'test.py', + ], + timeout: 60, + workdir: meson.project_source_root(), +) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..e44bd45e2 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('docdir', type: 'string') diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 5c1fd2807..000000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[bdist_rpm] -group=X11/Applications/Graphics -release=1 -packager=Edwin Young (edwin@bathysphere.org) diff --git a/setup.py b/setup.py deleted file mode 100755 index 5e6a05587..000000000 --- a/setup.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup, Extension -import setuptools.command.build_py -import sysconfig -import os -import shutil -import subprocess -import sys - -gnofract4d_version = '4.3' - -_DEBUG = False - -if sys.version_info < (3, 6): - print("Sorry, you need Python 3.6 or higher to run Gnofract 4D.") - print("You have version %s. Please upgrade." % sys.version) - sys.exit(1) - -if not os.path.exists(os.path.join(sysconfig.get_config_var("INCLUDEPY"), "Python.h")): - print("Python header files are required.") - print("Please install libpython3-dev") - sys.exit(1) - -if not shutil.which("glib-compile-resources"): - print("glib-compile-resources is required.") - print("Please install libglib2.0-dev-bin") - sys.exit(1) - -# by default python uses all the args which were used to compile it. But Python is C and some -# extension files are C++, resulting in annoying '-Wstrict-prototypes is not supported' messages. -# tweak the cflags to override -os.environ["CFLAGS"] = os.environ.get("CFLAGS", "").replace("-Wstrict-prototypes", "") - -# Extensions need to link against appropriate libs -# We use pkg-config to find the appropriate set of includes and libs - - -def call_package_config(package, option, optional=False): - '''invoke pkg-config, if it exists, to find the appropriate arguments for a library''' - try: - cp = subprocess.run(["pkg-config", package, option], - universal_newlines=True, stdout=subprocess.PIPE) - except FileNotFoundError: - print( - "Unable to check for '%s', pkg-config not installed" % package, file=sys.stderr) - if optional: - return [] - else: - sys.exit(1) - - if cp.returncode != 0: - if optional: - print("Can't find '%s'" % package, file=sys.stderr) - print("Some functionality will be disabled", file=sys.stderr) - return [] - else: - print( - "Development files not found for '%s'" % package, file=sys.stderr) - sys.exit(1) - - return cp.stdout.split() - - -png_flags = call_package_config("libpng", "--cflags") -png_libs = call_package_config("libpng", "--libs") -define_macros = [('PNG_ENABLED', 1)] - -jpeg_flags = call_package_config("libjpeg", "--cflags", True) -jpeg_libs = call_package_config("libjpeg", "--libs", True) -if jpeg_flags + jpeg_libs: - define_macros.append(('JPG_ENABLED', 1)) - - -class fract4d_build_py(setuptools.command.build_py.build_py): - def run(self): - print("running fract4d_build_py") - subprocess.run("./bin/resources.sh", check=True) - super().run() - - -fract4d_sources = [ - 'fract4d/c/fract4dmodule.cpp', - - 'fract4d/c/fract4dc/colormaps.cpp', - 'fract4d/c/fract4dc/loaders.cpp', - 'fract4d/c/fract4dc/sites.cpp', - 'fract4d/c/fract4dc/images.cpp', - 'fract4d/c/fract4dc/calcs.cpp', - 'fract4d/c/fract4dc/workers.cpp', - 'fract4d/c/fract4dc/functions.cpp', - 'fract4d/c/fract4dc/arenas.cpp', - 'fract4d/c/fract4dc/utils.cpp', - 'fract4d/c/fract4dc/calcargs.cpp', - 'fract4d/c/fract4dc/pysite.cpp', - - 'fract4d/c/fract4dc/controllers.cpp', - - 'fract4d/c/model/calcfunc.cpp', - 'fract4d/c/model/fractfunc.cpp', - 'fract4d/c/model/site.cpp', - 'fract4d/c/model/image.cpp', - 'fract4d/c/model/imagewriter.cpp', - 'fract4d/c/model/imagereader.cpp', - 'fract4d/c/model/colormap.cpp', - 'fract4d/c/model/worker.cpp', - 'fract4d/c/model/STFractWorker.cpp', - 'fract4d/c/model/MTFractWorker.cpp', - 'fract4d/c/model/pointfunc.cpp', - 'fract4d/c/model/stats.cpp', - 'fract4d/c/model/colorutils.cpp', - 'fract4d/c/model/imageutils.cpp', - - 'fract4d/c/fract_stdlib.cpp' -] - -define_macros.append(('THREADS', 1)) -extra_compile_args = ['-std=c++17', '-Wall', - '-Wextra', '-Wpedantic', '-Wno-attributes'] - -# from https://pythonextensionpatterns.readthedocs.io/en/latest/compiler_flags.html?highlight=python3-dev -if _DEBUG: - extra_compile_args += ["-g3", "-O0", "-UNDEBUG"] - define_macros += [ - # ('STATIC_CALC',1), - # ('NO_CALC', 1), # set this to not calculate the fractal - # ('DEBUG_CREATION',1), # debug spew for allocation of objects - # ('DEBUG_ALLOCATION',1), # debug spew for array handling - # ('DEBUG_PIXEL',1), # debug spew for array handling - # ('EXPERIMENTAL_OPTIMIZATIONS',1), # enables some experimental optimizations - ] -elif not os.environ["CFLAGS"]: - extra_compile_args += ["-DNDEBUG", "-O3"] - -module_fract4dc = Extension( - name='fract4d.fract4dc', - sources=fract4d_sources, - include_dirs=['fract4d/c', 'fract4d/c/fract4dc', 'fract4d/c/model'], - libraries=['stdc++'], - extra_compile_args=extra_compile_args + png_flags + jpeg_flags, - extra_link_args=png_libs + jpeg_libs, - define_macros=define_macros, -) - - - -def get_files(dir, ext): - return [os.path.join(dir, x) for x in os.listdir(dir) if x.endswith(ext)] - - -def get_icons(): - icons = [] - for size in 16, 32, 48, 64, 128, 256: - icons.append(('share/icons/hicolor/{0}x{0}/apps'.format(size), - ['pixmaps/logo/{0}x{0}/gnofract4d.png'.format(size)])) - return icons - - -so_extension = sysconfig.get_config_var("EXT_SUFFIX") - -setup( - name='gnofract4d', - version=gnofract4d_version, - description='A program to draw fractals', - long_description='''Gnofract 4D is a fractal browser. It can generate many different fractals, -including some which are hybrids between the Mandelbrot and Julia sets, -and includes a Fractint-compatible parser for your own fractal formulas.''', - author='Edwin Young', - author_email='edwin@bathysphere.org', - maintainer='Edwin Young', - maintainer_email='edwin@bathysphere.org', - keywords="fractal mandelbrot julia", - url='http://github.com/fract4d/gnofract4d/', - packages=['fract4d_compiler', 'fract4d', 'fract4dgui'], - package_data={ - 'fract4d': ['c/pf.h', 'c/fract_stdlib.h', 'c/model/imageutils.h', 'c/model/colorutils.h'] - }, - ext_modules=[module_fract4dc], - scripts=['gnofract4d'], - data_files=[ - # compiled GUI resources - ('share/gnofract4d', ['gnofract4d.gresource']), - # color maps - ( - 'share/gnofract4d/maps', - get_files("maps", ".map") + - get_files("maps", ".cs") + - get_files("maps", ".ugr") - ), - # formulas - ( - 'share/gnofract4d/formulas', - get_files("formulas", "frm") + - get_files("formulas", "ucl") + - get_files("formulas", "uxf") - ), - # documentation - ( - 'share/gnofract4d/help', - get_files("help", "html") + - get_files("help", "png") + - get_files("help", "css") - ), - # icon - ('share/pixmaps', ['pixmaps/logo/48x48/gnofract4d.png']), - # theme icons - *get_icons(), - # .desktop file - ('share/applications', ['io.github.fract4d.desktop']), - # MIME type registration - ('share/mime/packages', ['gnofract4d-mime.xml']), - # doc files - ('share/doc/gnofract4d/', ['LICENSE', 'README.md']) - ], - cmdclass={'build_py': fract4d_build_py,}, -) - -# I need to find the file I just built and copy it up out of the build -# location so it's possible to run without installing. Can't find a good -# way to extract the actual target directory out of distutils, hence -# this egregious hack - -lib_targets = { - "fract4dc" + so_extension: "fract4d", -} - - -def copy_libs(root, dirlist, namelist): - for name in namelist: - target = lib_targets.get(name) - if target is not None: - shutil.copy(os.path.join(root, name), target) - - -for root, dirs, files in os.walk("build"): - copy_libs(root, dirs, files) diff --git a/test.py b/test.py index 5ca236d63..3d7e3e3b7 100755 --- a/test.py +++ b/test.py @@ -13,16 +13,6 @@ class Test(unittest.TestCase): - def testSetupPyVersionMatches(self): - with open("setup.py") as doc: - content = doc.read() - - doc_re = re.compile(r"gnofract4d_version = '(\S+)'") - m = doc_re.search(content) - - self.assertTrue(m, "setup.py doesn't specify version") - self.assertEqual(options.VERSION, m.group(1)) - def testDocVersionMatches(self): # check the docs with open("manual/config.toml") as doc: @@ -34,16 +24,6 @@ def testDocVersionMatches(self): self.assertTrue(m, "manual doesn't specify version") self.assertEqual(options.VERSION, m.group(1), "Version mismatch") - def testReadmeVersionMatches(self): - with open("README.md") as doc: - content = doc.read() - - ver_re = re.compile(r'gnofract4d-(\S+)\.tar\.gz') - - m = ver_re.search(content) - self.assertTrue(m, "README doesn't specify version") - self.assertEqual(options.VERSION, m.group(1), "Version mismatch") - def testWebsiteVersionMatches(self): if not os.path.exists("website"): # not included in source dist