setup.py 1.29 KB
Newer Older
1 2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
3

4 5
import sys
from setuptools import setup, find_packages
6

7 8 9
if sys.version_info < (3, 6):
    print('zesje requires Python 3.6 or higher')
    sys.exit(1)
10 11


Joseph Weston's avatar
Joseph Weston committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# Loads version.py module without importing the whole package.
def get_version_and_cmdclass(package_path):
    import os
    from importlib.util import module_from_spec, spec_from_file_location
    spec = spec_from_file_location('version',
                                   os.path.join(package_path, '_version.py'))
    module = module_from_spec(spec)
    spec.loader.exec_module(module)
    return module.__version__, module.cmdclass


version, cmdclass = get_version_and_cmdclass('zesje')
# will be replaced by the overriding classes below
_sdist = cmdclass.pop('sdist')


class sdist(_sdist):
29
    def run(self):
30 31 32
        import subprocess
        subprocess.check_call(['yarn', 'install'])
        subprocess.check_call(['yarn', 'build'])
33 34 35
        super().run()


Joseph Weston's avatar
Joseph Weston committed
36 37 38
cmdclass['sdist'] = sdist


39 40
setup(
    name="zesje",
Joseph Weston's avatar
Joseph Weston committed
41
    version=version,
42 43 44 45 46
    url="http://gitlab.kwant-project,org/zesje/zesje",
    description="",
    author="Zesje authors",
    author_email="anton.akhmerov@tudelft.nl",
    packages=find_packages('.'),
Joseph Weston's avatar
Joseph Weston committed
47
    cmdclass=cmdclass,
48 49 50
    package_data={'zesje': ['static/*']},
    include_package_data=True,
)