How to run Addon Manager in Headless mode?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: How to run Addon Manager in Headless mode?

Post by sgrogan »

Kunda1 wrote: Sun Oct 27, 2019 12:23 am I'm still confused as to what the function of git.Git() does
https://gitpython.readthedocs.io/en/sta ... le-git.cmd
"fight the good fight"
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

Thanks for that.

workbenches now output in a 3 columns

So there are 2 issues remaining..
1) when running using the check flag (which triggers CheckUpdateRepo, the script should just be checking if there are updates pending, but instead it's also downloading said updates.
2) InstallRepo() is also showing the repository has been downloaded as well but is still reporting an error. I think I know the issue why but I've been looking at this script too long...i need to step away from it.

https://gist.github.com/luzpaz/f3bfaaef ... /revisions
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

Ok, something odd is happening.
background: the way the Headless script (based on yorik's AddonManager scripts) checks if there are updates for workbenches is simply running a git status and then regexing the output to for 'git pull' will give you the amount of commits your branch is behind remote master:

Code: Select all

                if "git pull" in gitrepo.status():
                    print('\t' + repo[0] + ' ' + 'has an update')
                    status = re.findall(r"Your branch (.*)\,", gitrepo.status())
                    # print how many commits we are behind master
                    print('\t\t' + repo[0] + ' ' + status[0] + '\n')

But recently git status hasn't been behaving this way. For example:

Code: Select all

[foo@foo Glass]$ git status origin
On branch master
nothing to commit, working tree clean

[foo@foo Glass]$ git fetch
From https://github.com/triplus/Glass
 * branch            HEAD       -> FETCH_HEAD

[foo@foo Glass]$ git pull
From https://github.com/triplus/Glass
 * branch            HEAD       -> FETCH_HEAD
Updating 037588b..d7b73e6
Fast-forward
 GlassGui.py                | 183 +++++++++++++++++++++++++++++++++++++
 InitGui.py                 |  28 ++++++
 License/lgpl-2.1.txt       | 502 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 README.md                  |  35 +++++++-
 Resources/images/Glass.png | Bin 0 -> 9959 bytes
 5 files changed, 747 insertions(+), 1 deletion(-)
 create mode 100644 GlassGui.py
 create mode 100644 InitGui.py
 create mode 100644 License/lgpl-2.1.txt
 create mode 100644 Resources/images/Glass.png

[foo@foo Glass]$ ls
GlassGui.py  InitGui.py  License  README.md  Resources

[foo@foo Glass]$ git reset --hard HEAD~1
HEAD is now at 037588b Initial commit

[foo@foo Glass]$ git status
On branch master
nothing to commit, working tree clean
As you can see from above, the Glass repo wasn't originally up to date with upstream and git status didn't report this.
I first git fetch which returns a generic * branch HEAD -> FETCH_HEAD which I don't full grok what it means (explanation here and here). I ran a git pull which then showed there was an update pending..wth?
Then I git reset --hard HEAD~1 the local Glass repo rollback 1 commit behind master. I ran git status again, still reports everything is OK.

what am I missing ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

yorik wrote::bell:
@yorik do you mind weighing in on this? I'm so close to making this happen.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

help is requested
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

Also, I need some help in figuring out how to remove addons from user.cfg (and system.cfg) based on the addon being removed, each addon may indivdually alter different parts of the user.cfg file (for example, TabBar)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

openBrain wrote::bell:
Would you be interested debugging this script. I'm at a loss here.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How to run Addon Manager in Headless mode?

Post by openBrain »

Kunda1 wrote: Sun Nov 03, 2019 5:35 pm
openBrain wrote::bell:
Would you be interested debugging this script. I'm at a loss here.
I'm interested to help (at least :P). Unfortunately probably very few spare time in the coming days. Would you be able to send a PM with a concise summary of what you're trying to achieve, where you are and what is blocking ATM? So I can quickly have a macro vision. Pointers to existing posts are OK as well. :)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Post by Kunda1 »

openBrain wrote: Sun Nov 03, 2019 11:13 pm I'm interested to help (at least :P). Unfortunately probably very few spare time in the coming days. Would you be able to send a PM with a concise summary of what you're trying to achieve, where you are and what is blocking ATM? So I can quickly have a macro vision. Pointers to existing posts are OK as well. :)
Great. I'll post it here instead of PM that way if anyone else wants to help they're more than invited.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How to run Addon Manager in Headless mode?

Post by openBrain »

Kunda1 wrote: Mon Nov 04, 2019 5:02 pm Great. I'll post it here instead of PM that way if anyone else wants to help they're more than invited.
Good. As I didn't follow the topic, I worried that it may be redundant with the whole thread. ;)
Post Reply