diff options
Diffstat (limited to 'pending')
| -rw-r--r-- | pending/.dockerignore | 6 | ||||
| -rw-r--r-- | pending/Dockerfile | 25 | ||||
| -rw-r--r-- | pending/Procfile | 1 | ||||
| -rw-r--r-- | pending/app.json | 11 | ||||
| -rw-r--r-- | pending/bin/compile | 6 | ||||
| -rw-r--r-- | pending/bin/detect | 4 | ||||
| -rw-r--r-- | pending/dodo.py | 193 | ||||
| -rw-r--r-- | pending/package.json | 30 | ||||
| -rw-r--r-- | pending/requirements.pacman.linux.txt | 5 | ||||
| -rw-r--r-- | pending/runtime.txt | 1 | ||||
| -rw-r--r-- | pending/webpack.config.js | 39 |
11 files changed, 0 insertions, 321 deletions
diff --git a/pending/.dockerignore b/pending/.dockerignore deleted file mode 100644 index 2b6c642..0000000 --- a/pending/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -__pycache__ -/.doit.db -/build -/dist -/node_modules -/yarn-error.log diff --git a/pending/Dockerfile b/pending/Dockerfile deleted file mode 100644 index 0e093c5..0000000 --- a/pending/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM python:3.8-buster AS base - - -FROM base AS build - -RUN apt-get update \ - && apt-get install -q -y nodejs yarnpkg \ - && ln -s /usr/bin/yarnpkg /usr/bin/yarn - -COPY . /opcut - -RUN cd /opcut \ - && pip install -r requirements.txt \ - && doit - - -FROM base AS run - -COPY --from=build /opcut/dist /opcut/dist - -RUN pip install /opcut/dist/* - -EXPOSE 80 - -CMD ["opcut", "server", "--addr", "http://0.0.0.0:80"] diff --git a/pending/Procfile b/pending/Procfile deleted file mode 100644 index 175affd..0000000 --- a/pending/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: python -m opcut.main server --addr http://0.0.0.0:$PORT diff --git a/pending/app.json b/pending/app.json deleted file mode 100644 index 13044b9..0000000 --- a/pending/app.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "opcut", - "website": "http://opcut.heroku.com", - "repository": "https://github.com/bozokopic/opcut", - "image": "heroku/python", - "buildpacks": [ - {"url": "heroku/python"}, - {"url": "heroku/nodejs"}, - {"url": "https://github.com/bozokopic/opcut"} - ] -} diff --git a/pending/bin/compile b/pending/bin/compile deleted file mode 100644 index 9aa8e6c..0000000 --- a/pending/bin/compile +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd $1 -doit clean_all -doit -pip install ./dist/*.whl diff --git a/pending/bin/detect b/pending/bin/detect deleted file mode 100644 index 2315487..0000000 --- a/pending/bin/detect +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -echo "opcut build" -exit 0 diff --git a/pending/dodo.py b/pending/dodo.py deleted file mode 100644 index 5951fb7..0000000 --- a/pending/dodo.py +++ /dev/null @@ -1,193 +0,0 @@ -from pathlib import Path -import datetime -import os -import shutil -import subprocess -import sys - -import packaging.version - - -DOIT_CONFIG = {'backend': 'sqlite3', - 'default_tasks': ['dist'], - 'verbosity': 2} - - -pythonpath = os.environ.get('PYTHONPATH') -src_py_path = str(Path('src_py').resolve()) - -sys.path += [src_py_path] -if pythonpath: - os.environ['PYTHONPATH'] = f'{src_py_path}{os.pathsep}{pythonpath}' -else: - os.environ['PYTHONPATH'] = src_py_path - - -build_dir = Path('build') -dist_dir = Path('dist') -py_build_dir = build_dir / 'py' -js_build_dir = build_dir / 'js' - -docker_img = 'bozokopic/opcut' - - -def task_clean_all(): - """Clean all""" - return {'actions': [f'rm -rf {build_dir}', - f'rm -rf {dist_dir}']} - - -def task_check(): - """Run linters""" - def flake8(): - subprocess.run(['python', '-m', 'flake8', '.'], - cwd='src_py', - check=True) - - return {'actions': [flake8, - 'yarn run --silent check_js', - 'yarn run --silent check_sass'], - 'task_dep': ['js_deps']} - - -def task_js_deps(): - """Install js dependencies""" - return {'actions': ['yarn install --silent']} - - -def task_js_build(): - """Build js""" - return {'actions': ['yarn run --silent build'], - 'task_dep': ['js_deps']} - - -def task_js_watch(): - """Build js on change""" - - return {'actions': ['yarn run --silent watch'], - 'task_dep': ['js_deps']} - - -def task_py_build(): - """Build py""" - def mappings(): - src_py_dir = Path('src_py') - for i in (src_py_dir / 'opcut').rglob('*.py'): - yield i, dst_dir / i.relative_to(src_py_dir) - - src_json_dir = Path('schemas_json') - for i in src_json_dir.rglob('*.yaml'): - yield i, (dst_dir / 'opcut/schemas_json' - / i.relative_to(src_json_dir)) - - for i in js_build_dir.rglob('*'): - if i.is_dir(): - continue - yield i, (dst_dir / 'opcut/ui' - / i.relative_to(js_build_dir)) - - dst_dir = py_build_dir - setup_path = dst_dir / 'setup.py' - manifest_path = dst_dir / 'MANIFEST.in' - src_paths = list(src_path for src_path, _ in mappings()) - dst_paths = [setup_path, *(dst_path for _, dst_path in mappings())] - return {'actions': [(_copy_files, [mappings]), - (_create_manifest, [manifest_path, mappings]), - (_create_setup_py, [setup_path])], - 'file_dep': src_paths, - 'targets': dst_paths, - 'task_dep': ['js_build']} - - -def task_dist(): - """Create distribution""" - def dist(): - dist_dir.mkdir(parents=True, exist_ok=True) - subprocess.run(['python', 'setup.py', '-q', 'bdist_wheel', - '--dist-dir', str(dist_dir.resolve())], - cwd=str(py_build_dir), - check=True) - - return {'actions': [dist], - 'task_dep': ['py_build']} - - -def task_docker_build(): - """Create docker image""" - def build(): - version = _get_version() - subprocess.run(['docker', 'build', '-t', f'{docker_img}:{version}', - '.'], - check=True) - - return {'actions': [build]} - - -def task_docker_upload(): - """Upload docker image""" - def upload(): - version = _get_version() - subprocess.run(['docker', 'push', f'{docker_img}:{version}'], - check=True) - - return {'actions': [upload]} - - -def _create_setup_py(path): - version = _get_version() - readme = _get_readme() - dependencies = ['aiohttp', - 'pycairo', - 'hat-util'] - entry_points = {'console_scripts': ['opcut = opcut.main:main']} - options = {'bdist_wheel': {'python_tag': 'cp38', - 'py_limited_api': 'cp38', - 'plat_name': 'any'}} - classifiers = ['Programming Language :: Python :: 3'] - with open(path, 'w', encoding='utf-8') as f: - f.write(f"from setuptools import setup\n\n\n" - f"readme = r\"\"\"\n{readme}\n\"\"\"\n\n" - f"setup(name='opcut',\n" - f" version={repr(version)},\n" - f" description='Cutting stock problem optimizer',\n" - f" long_description=readme,\n" - f" long_description_content_type='text/x-rst',\n" - f" url='https://github.com/bozokopic/opcut',\n" - f" author='Bozo Kopic',\n" - f" author_email='bozo.kopic@gmail.com',\n" - f" license='GPLv3',\n" - f" packages=['opcut'],\n" - f" include_package_data=True,\n" - f" install_requires={repr(dependencies)},\n" - f" python_requires='>=3.8',\n" - f" zip_safe=False,\n" - f" classifiers={repr(classifiers)},\n" - f" options={repr(options)},\n" - f" entry_points={repr(entry_points)})\n") - - -def _copy_files(mappings): - for src_path, dst_path in mappings(): - if not dst_path.parent.exists(): - dst_path.parent.mkdir(parents=True, exist_ok=True) - shutil.copyfile(str(src_path), str(dst_path)) - - -def _create_manifest(path, mappings): - with open(path, 'w', encoding='utf-8') as f: - for _, i in mappings(): - f.write(f"include {i.relative_to(path.parent)}\n") - - -def _get_version(): - with open('VERSION', encoding='utf-8') as f: - version_str = f.read().strip() - if version_str.endswith('dev'): - version_str += datetime.datetime.now().strftime("%Y%m%d") - version = packaging.version.Version(version_str) - return version.public - - -def _get_readme(): - with open('README.rst', encoding='utf-8') as f: - return f.read().strip() diff --git a/pending/package.json b/pending/package.json deleted file mode 100644 index dc193f8..0000000 --- a/pending/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "private": true, - "scripts": { - "build": "webpack", - "watch": "webpack -w", - "check_js": "eslint src_js", - "check_sass": "sass-lint src_scss/**/*.scss" - }, - "devDependencies": { - "@hat-core/renderer": "0.4.0-dev20200410", - "@hat-core/util": "0.4.0-dev20200410", - "copy-webpack-plugin": "5.1.1", - "css-loader": "3.5.2", - "eslint": "6.8.0", - "file-loader": "6.0.0", - "file-saver": "2.0.2", - "hyperscript": "2.0.2", - "izitoast": "1.4.0", - "node-sass": "4.13.1", - "normalize.css": "8.0.1", - "papaparse": "5.2.0", - "resolve-url-loader": "3.1.1", - "sass-lint": "1.13.1", - "sass-loader": "8.0.2", - "style-loader": "1.1.3", - "uri-js": "4.2.2", - "webpack": "4.42.1", - "webpack-cli": "3.3.11" - } -} diff --git a/pending/requirements.pacman.linux.txt b/pending/requirements.pacman.linux.txt deleted file mode 100644 index 6b5d366..0000000 --- a/pending/requirements.pacman.linux.txt +++ /dev/null @@ -1,5 +0,0 @@ -git -nodejs -yarn -python -python-pip diff --git a/pending/runtime.txt b/pending/runtime.txt deleted file mode 100644 index 724c203..0000000 --- a/pending/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.8.2 diff --git a/pending/webpack.config.js b/pending/webpack.config.js deleted file mode 100644 index 57d31c1..0000000 --- a/pending/webpack.config.js +++ /dev/null @@ -1,39 +0,0 @@ -const path = require('path'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); - - -module.exports = { - mode: 'none', - entry: '.' + path.sep + path.join('src_js', 'opcut', 'main'), - output: { - filename: 'main.js', - path: path.join(__dirname, 'build', 'js') - }, - module: { - rules: [ - { - test: /\.scss$/, - use: ["style-loader", "css-loader", "resolve-url-loader", "sass-loader?sourceMap"] - }, - { - test: /\.woff2$/, - use: "file-loader?name=fonts/[name].[ext]" - } - ] - }, - resolve: { - modules: [ - path.join(__dirname, 'src_js'), - path.join(__dirname, 'src_scss'), - path.join(__dirname, 'node_modules') - ] - }, - watchOptions: { - ignored: /node_modules/ - }, - plugins: [ - new CopyWebpackPlugin([{from: 'src_web'}]) - ], - devtool: 'source-map', - stats: 'errors-only' -}; |
