mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2025-12-15 16:40:05 +01:00
added cache files to package and building during setup
This commit is contained in:
@@ -2,6 +2,8 @@ include README.rst
|
|||||||
include LICENSE
|
include LICENSE
|
||||||
include tox.ini
|
include tox.ini
|
||||||
recursive-include osaca/data/ *.yml
|
recursive-include osaca/data/ *.yml
|
||||||
|
recursive-include osaca/data/ *.pickle
|
||||||
|
include osaca/data/_build_cache.py
|
||||||
include examples/*
|
include examples/*
|
||||||
recursive-include tests *.py *.out
|
recursive-include tests *.py *.out
|
||||||
recursive-include tests/testfiles/ *
|
recursive-include tests/testfiles/ *
|
||||||
|
|||||||
24
osaca/data/_build_cache.py
Normal file
24
osaca/data/_build_cache.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from glob import glob
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
sys.path[0:0] = ['../..']
|
||||||
|
|
||||||
|
from osaca.semantics.hw_model import MachineModel
|
||||||
|
|
||||||
|
print('Building cache: ', end='')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
# Iterating architectures
|
||||||
|
for f in glob(os.path.join(os.path.dirname(__file__), '*.yml')):
|
||||||
|
MachineModel(path_to_yaml=f)
|
||||||
|
print('.', end='')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
# Iterating ISAs
|
||||||
|
for f in glob(os.path.join(os.path.dirname(__file__), 'isa/*.yml')):
|
||||||
|
MachineModel(path_to_yaml=f)
|
||||||
|
print('+', end='')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
print()
|
||||||
27
setup.py
27
setup.py
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
# Always prefer setuptools over distutils
|
# Always prefer setuptools over distutils
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from setuptools.command.install import install as _install
|
||||||
|
from setuptools.command.sdist import sdist as _sdist
|
||||||
# To use a consistent encoding
|
# To use a consistent encoding
|
||||||
from codecs import open
|
from codecs import open
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
@@ -27,6 +30,27 @@ def find_version(*file_paths):
|
|||||||
raise RuntimeError("Unable to find version string.")
|
raise RuntimeError("Unable to find version string.")
|
||||||
|
|
||||||
|
|
||||||
|
def _run_build_cache(dir):
|
||||||
|
from subprocess import check_call
|
||||||
|
# This is run inside the install staging directory (that had no .pyc files)
|
||||||
|
# We don't want to generate any.
|
||||||
|
# https://github.com/eliben/pycparser/pull/135
|
||||||
|
check_call([sys.executable, '-B', '_build_cache.py'],
|
||||||
|
cwd=os.path.join(dir, 'osaca', 'data'))
|
||||||
|
|
||||||
|
|
||||||
|
class install(_install):
|
||||||
|
def run(self):
|
||||||
|
_install.run(self)
|
||||||
|
self.execute(_run_build_cache, (self.install_lib,), msg="Build ISA and architecture cache")
|
||||||
|
|
||||||
|
|
||||||
|
class sdist(_sdist):
|
||||||
|
def make_release_tree(self, basedir, files):
|
||||||
|
_sdist.make_release_tree(self, basedir, files)
|
||||||
|
self.execute(_run_build_cache, (basedir,), msg="Build ISA and architecture cache")
|
||||||
|
|
||||||
|
|
||||||
# Get the long description from the README file
|
# Get the long description from the README file
|
||||||
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
@@ -124,4 +148,7 @@ setup(
|
|||||||
'osaca=osaca.osaca:main',
|
'osaca=osaca.osaca:main',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# Overwriting install and sdist to enforce cache distribution with package
|
||||||
|
cmdclass={'install': install, 'sdist': sdist},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user