How to run Addon Manager in Headless mode?

Need help, or want to share a macro? Post here!
User avatar
sgrogan
Posts: 5469
Joined: Wed Oct 22, 2014 5:02 pm

Re: How to run Addon Manager in Headless mode?

Postby sgrogan » Sun Oct 27, 2019 2:38 am

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
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Sun Oct 27, 2019 9:05 pm

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
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Mon Oct 28, 2019 12:07 pm

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 ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Tue Oct 29, 2019 2:27 pm

yorik wrote::bell:
@yorik do you mind weighing in on this? I'm so close to making this happen.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Thu Oct 31, 2019 2:32 am

help is requested
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Thu Oct 31, 2019 8:37 pm

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)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Sun Nov 03, 2019 5:35 pm

openBrain wrote::bell:
Would you be interested debugging this script. I'm at a loss here.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
openBrain
Posts: 2372
Joined: Fri Nov 09, 2018 5:38 pm

Re: How to run Addon Manager in Headless mode?

Postby openBrain » Sun Nov 03, 2019 11:13 pm

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
Posts: 5927
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to run Addon Manager in Headless mode?

Postby Kunda1 » Mon Nov 04, 2019 5:02 pm

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.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
openBrain
Posts: 2372
Joined: Fri Nov 09, 2018 5:38 pm

Re: How to run Addon Manager in Headless mode?

Postby openBrain » Mon Nov 04, 2019 5:09 pm

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. ;)