Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
colin4124 committed Jun 30, 2020
0 parents commit d825074
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Chisel3 Jar Package CI
language: python
script:
- make prepare
- python setup.py bdist_wheel
deploy:
provider: pypi
username: $PYPI_NAME
password: $PYPI_PW
skip_cleanup: true
on:
tags: true
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CACHE_TAR = https://github.com/colin4124/scratchip-binary/releases/download/v0.1/cache.tar.gz

prepare:
mkdir -p mill_cache/assets
wget -O mill_cache/assets/cache.tar.gz $(CACHE_TAR)
4 changes: 4 additions & 0 deletions mill_cache/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from mill_bin.version import version as __version__
except ImportError:
__version__ = "unknown"
71 changes: 71 additions & 0 deletions mill_cache/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# See LICENSE for license details.

import argparse
import os
import sys
import pkg_resources
import shutil

# Check if this is run from a local installation
milldir = os.path.abspath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
)
if os.path.exists(os.path.join(milldir, "mill_cache")):
sys.path[0:0] = [milldir]

from mill_cache import __version__

def get_resource_name(name):
return pkg_resources.resource_filename(__name__, name)

def get_resource_string(name):
return pkg_resources.resource_string(__name__, name)

class MILLCache:
def create(self, args):
jars_path = args.dest_path
if not os.path.exists(jars_path):
os.mkdir(jars_path)

shutil.copyfile(get_resource_name('assets/cache.tar.gz'), os.path.join(jars_path, 'cache.tar.gz'))

def parse_args():
parser = argparse.ArgumentParser()

# Global actions
parser.add_argument(
"--version",
help="Show the Mill Cache version",
action="version",
version=__version__,
)

parser.add_argument(
'dest_path', metavar="destination", type=str, nargs='?',
default='.', help='Copy to the destination path')
parser.set_defaults(func=create)

args = parser.parse_args()

if hasattr(args, "func"):
return args
if hasattr(args, "subparser"):
args.subparser.print_help()
else:
parser.print_help()
return None

def create(args):
sc = MILLCache()
sc.create(args)

def main():
args = parse_args()
if not args:
exit(0)

# Run the function
args.func(args)

if __name__ == "__main__":
main()
Empty file added requirements.txt
Empty file.
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding:utf-8

from setuptools import setup

setup(
name="mill-cache",
url='https://github.com/jlsemi',
packages=["mill_cache"],
package_data={
"mill_cache": [
"assets/cache.tar.gz",
],
},
use_scm_version={"relative_to": __file__, "write_to": "mill_cache/version.py",},
author="Leway Colin@JLSemi",
author_email="[email protected]",
description=(
"Mill Cache is a tarball with all of mill's dependencies."
),
license="Apache-2.0 License",
keywords=[
"mill cache files",
],
entry_points={"console_scripts": ["mill_cache = mill_cache.main:main"]},
setup_requires=["setuptools_scm",],
install_requires=[
],
# Supported Python versions: 3.6+
python_requires=">=3.6",
)

0 comments on commit d825074

Please sign in to comment.