Making stuff available for external python programming.

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making stuff available for external python programming.

Post by vocx »

keithsloan52 wrote: Thu Sep 26, 2019 6:32 am ...
My install instructions say to clone the repository via git and then run a script to softlink into FreeCAD.
There is a script for Linux and one for Mac. ...
But... why?

Why does it have to be done this way?

Most workbenches should work by just dropping them into the local Mod/ directory of the FreeCAD installation. If yours doesn't work this way, then you should probably refactor it so that it does. Then it would just work with the Addon Manager.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Making stuff available for external python programming.

Post by keithsloan52 »

vocx wrote: Thu Sep 26, 2019 5:04 pm
keithsloan52 wrote: Thu Sep 26, 2019 6:32 am ...
My install instructions say to clone the repository via git and then run a script to softlink into FreeCAD.
There is a script for Linux and one for Mac. ...
But... why?

Why does it have to be done this way?

Most workbenches should work by just dropping them into the local Mod/ directory of the FreeCAD installation. If yours doesn't work this way, then you should probably refactor it so that it does. Then it would just work with the Addon Manager.
Because to me it seems a better way
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making stuff available for external python programming.

Post by vocx »

keithsloan52 wrote: Thu Sep 26, 2019 5:51 pm Because to me it seems a better way
So you are intentionally deviating from the recommended way of installing workbenches? I don't think this benefits users. You should make it easy for users to install and use your workbench; they shouldn't have to require special instructions.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Making stuff available for external python programming.

Post by keithsloan52 »

vocx wrote: Thu Sep 26, 2019 5:55 pm
keithsloan52 wrote: Thu Sep 26, 2019 5:51 pm Because to me it seems a better way
So you are intentionally deviating from the recommended way of installing workbenches? I don't think this benefits users. You should make it easy for users to install and use your workbench; they shouldn't have to require special instructions.
I did not intentionally deviate from the recommended way. When I started developing workbenchs back in FreeCAD 0.13 there was no addon etc.
Think you should stop being so high and mighty. It seems a pity to me that the recommended methods used still have shortcomings and could have been implemented better
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making stuff available for external python programming.

Post by vocx »

keithsloan52 wrote: Thu Sep 26, 2019 10:15 pm ...
It seems a pity to me that the recommended methods used still have shortcomings and could have been implemented better
You should describe what these shortcomings are. It's the only way of addressing them.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Making stuff available for external python programming.

Post by keithsloan52 »

vocx wrote: Thu Sep 26, 2019 10:29 pm
keithsloan52 wrote: Thu Sep 26, 2019 10:15 pm ...
It seems a pity to me that the recommended methods used still have shortcomings and could have been implemented better
You should describe what these shortcomings are. It's the only way of addressing them.
The shortcoming is that if the user updates a git repository with a git fetch the changes are not automatically picked up by FreeCAD.
This is not an issue if the install process did a softlink.

For example between $ROOT_DIR/Mod/ and the Mod directory in the Repository.

Or if you see permissions to updating $ROOT_DIR/Mod/ as a problem

On Linux it is usually /home/username/.FreeCAD/Mod/
On Windows it is usually C:\Users\username\Application Data\FreeCAD\Mod\
On Mac OSX it is usually /Users/username/Library/Preferences/FreeCAD/Mod/

Softlinks has been standard on Linux and Mac for eons. On Windows see https://www.howtogeek.com/howto/16226/c ... -or-linux/

It seems to me whoever setup the installation methods did not have an understanding of softlinks and their benefits
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making stuff available for external python programming.

Post by vocx »

keithsloan52 wrote: Thu Sep 26, 2019 10:42 pm The shortcoming is that if the user updates a git repository with a git fetch the changes are not automatically picked up by FreeCAD.
...
What? Of course they are.

That's the standard installation method, to download something and put it in the Mod directory. If you need to update, just git pull the new code. That's what the Addon Manager does essentially.

https://github.com/FreeCAD/FreeCAD/blob ... rs.py#L735

Code: Select all

    addondir = os.path.join(FreeCAD.getUserAppDataDir(),"Mod",name)
        if os.path.exists(addondir):
            if os.path.exists(addondir + os.sep + '.git'):
                gitrepo = git.Git(addondir)
                try:
                    gitrepo.fetch()
                    if "git pull" in gitrepo.status():
                        self.updateAvailable.emit(True)
                        return
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Making stuff available for external python programming.

Post by keithsloan52 »

So FreeCAD does a git fetch for every Workbench of this type? Every time FreeCAD starts?
What happens if the network is down ?
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Making stuff available for external python programming.

Post by keithsloan52 »

Maybe this question should go in a new thread.

But what is the state of play with Workbenches that are compiled C++
For example https://github.com/McCadKIT/FreeCAD-McCad
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making stuff available for external python programming.

Post by vocx »

keithsloan52 wrote: Fri Sep 27, 2019 2:14 am So FreeCAD does a git fetch for every Workbench of this type? Every time FreeCAD starts?
What happens if the network is down ?
The system checks for updates only if you open the Addon Manager, it is not done automatically. If the network is down, then of course you can't check or download updates; it will just use the already existing code in the Mod/ directory.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply