This repository has been archived by the owner on Jul 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
KennethWilke
committed
Mar 2, 2016
0 parents
commit 2bc5dde
Showing
11 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.pyc | ||
venv/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.0.1, March 2nd 2016 -- Initial prototype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Copyright (c) 2016, Rackspace, Inc. <[email protected]> | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# file GENERATED by distutils, do NOT edit | ||
CHANGES.txt | ||
LICENSE.txt | ||
README.txt | ||
requirements.txt | ||
setup.py | ||
bin/packilog | ||
libpackilog/__init__.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include *.txt | ||
recursive-include docs *.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Packilog | ||
|
||
A package manager for SystemVerilog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
======== | ||
Packilog | ||
======== | ||
|
||
A package manager for SystemVerilog. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/python | ||
import argparse | ||
import os | ||
import json | ||
import libpackilog | ||
|
||
argparser = argparse.ArgumentParser(description="Pull in SystemVerilog code.") | ||
argparser.add_argument('-f', '--force', action='store_true') | ||
|
||
args = argparser.parse_args() | ||
|
||
manifest = None | ||
if os.path.exists('packilog.json'): | ||
manifest = json.load(open('packilog.json')) | ||
|
||
if manifest: | ||
libpackilog.pull_in_dependencies(manifest, force=args.force) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import requests | ||
import os | ||
|
||
|
||
def file_dependency(dependency, force=False): | ||
''' Pull down a file-type dependency ''' | ||
if 'source' not in dependency: | ||
print 'source for a file-based dependency was not defined' | ||
return | ||
if 'filename' not in dependency: | ||
print 'filename for a file-based dependency was not defined' | ||
return | ||
|
||
source = dependency['source'] | ||
filename = dependency['filename'] | ||
|
||
# Request file | ||
req = requests.get(source) | ||
if req.status_code != 200: | ||
error = "Failed to download dependency source from {0}: {1} {2}" | ||
print error.format(source, req.status_code, req.reason) | ||
return | ||
|
||
# Write file | ||
if os.path.exists(filename) and not force: | ||
if req.text == open(filename).read(): | ||
print '{0} is up to date'.format(filename) | ||
else: | ||
error = "File {0} already exists, use -f flag to force overwrite" | ||
print error.format(filename) | ||
else: | ||
with open(filename, 'w') as fp: | ||
fp.write(req.text) | ||
print '{0} downloaded from {1}'.format(filename, source) | ||
|
||
|
||
dependency_handlers = {'file': file_dependency} | ||
|
||
|
||
def pull_in_dependencies(manifest, force=False): | ||
''' Handles pulling in dependencies ''' | ||
# Return immediately if there are no dependencies to handle | ||
if 'dependencies' not in manifest: | ||
return | ||
|
||
for dependency in manifest['dependencies']: | ||
if dependency['type'] not in dependency_handlers: | ||
error = "ERROR: There is no handler for dependency type '{0}'." | ||
print error.format(dependency['type']) | ||
return | ||
else: | ||
dependency_handlers[dependency['type']](dependency, force) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
argparse==1.2.1 | ||
requests==2.9.1 | ||
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from distutils.core import setup | ||
|
||
setup( | ||
name="Packilog", | ||
version="0.0.1", | ||
author="Kenneth Wilke", | ||
author_email="[email protected]", | ||
packages=['libpackilog'], | ||
scripts=['bin/packilog'], | ||
url='https://github.com/KennethWilke/Packilog', | ||
license='LICENSE.txt', | ||
description="A package manager for SystemVerilog.", | ||
long_description=open('README.txt').read(), | ||
install_requires=[ | ||
"requests >= 2.9.1" | ||
], | ||
) |