Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chipforge_cli
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChipForge
chipforge_cli
Commits
1c0c45e4
Commit
1c0c45e4
authored
8 months ago
by
gling
Browse files
Options
Downloads
Patches
Plain Diff
Release 0.0.12
parent
b78eb59b
No related branches found
Branches containing commit
Tags
0.0.12
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
chipforge/autoupdate.py
+47
-0
47 additions, 0 deletions
chipforge/autoupdate.py
chipforge/cli.py
+4
-0
4 additions, 0 deletions
chipforge/cli.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
with
52 additions
and
1 deletion
chipforge/autoupdate.py
0 → 100644
+
47
−
0
View file @
1c0c45e4
import
os
import
click
import
importlib_metadata
from
.
import
colors
as
c
import
urllib.request
import
re
import
subprocess
import
sys
import
pkg_resources
PACKAGE_NAME
=
'
chipforge
'
INDEX_URL
=
'
https://git.ece.iastate.edu/api/v4/projects/6561/packages/pypi/simple/
'
def
autoupdate
():
try
:
my_version
=
importlib_metadata
.
version
(
PACKAGE_NAME
)
(
my_major
,
my_minor
,
my_patch
)
=
my_version
.
split
(
'
.
'
)
with
urllib
.
request
.
urlopen
(
INDEX_URL
+
PACKAGE_NAME
)
as
file
:
index
=
file
.
read
().
decode
(
'
utf-8
'
)
versions
=
re
.
findall
(
r
'
href=
"
[^#]+-(\d+\.\d+\.\d+)-py3-none-any.whl
'
,
index
)
for
version
in
versions
:
(
major
,
minor
,
patch
)
=
version
.
split
(
'
.
'
)
needs_update
=
False
if
my_major
<
major
:
needs_update
=
True
break
if
my_major
==
major
:
if
my_minor
<
minor
:
needs_update
=
True
break
if
my_minor
==
minor
:
if
my_patch
<
patch
:
needs_update
=
True
break
if
needs_update
:
click
.
echo
(
c
.
info
(
'
New version found, updating...
'
))
click
.
echo
(
c
.
info
(
'
Running
'
+
'
'
.
join
([
sys
.
executable
,
'
-m
'
,
'
pip
'
,
'
install
'
,
'
chipforge
'
,
'
-U
'
,
'
--user
'
,
'
--index-url
'
,
INDEX_URL
])))
subprocess
.
check_call
([
sys
.
executable
,
'
-m
'
,
'
pip
'
,
'
install
'
,
'
chipforge
'
,
'
-U
'
,
'
--user
'
,
'
--index-url
'
,
INDEX_URL
],
shell
=
False
)
os
.
execvp
(
sys
.
argv
[
0
],
sys
.
argv
)
except
importlib_metadata
.
PackageNotFoundError
:
pass
autoupdate
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
chipforge/cli.py
+
4
−
0
View file @
1c0c45e4
...
...
@@ -4,6 +4,8 @@ import subprocess
import
click
import
importlib_metadata
from
.autoupdate
import
autoupdate
from
.fpga
import
fpga
from
.firmware
import
flash
,
projectid
,
list_devices
,
free
from
.
import
colors
as
c
...
...
@@ -24,6 +26,8 @@ def cli(ctx: click.Context, chdir):
This is a set of utilities for use with a caravel project for the Chip Forge club.
"""
autoupdate
()
# Enable parsing environment variables CHIPFORGE_
ctx
.
auto_envvar_prefix
=
'
CHIPFORGE
'
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
1c0c45e4
[tool.poetry]
name
=
"chipforge"
version
=
"0.0.1
1
"
version
=
"0.0.1
2
"
description
=
"Chip Forge Python Utilities"
repository
=
"https://git.ece.iastate.edu/isu-chip-fab/chiputil.git"
authors
=
[
"Gregory Ling"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment