Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-12 Thread Mike Treglia via Qgis-user
Thanks, Jurgen! Much appreciated!

I haven't had luck yet, but if I get it to work, will let you all know what
the solution is.  From what I've found, it seems like git bash is based on
msys2, and changing "cmd /c" to "cmd //c" lets something run for fetchenv,
but gdal commands are not available after I run it.

Again, much appreciated, and more later if I figure it out!
Mike

On Thu, Jul 7, 2022 at 6:00 PM Jürgen E. Fischer via Qgis-user <
qgis-user@lists.osgeo.org> wrote:

> Hi Mike,
>
> On Thu, 07. Jul 2022 at 17:31:26 -0400, Mike Treglia wrote:
> > So I've added the below to my profile (from the link you've previously
> > shared), and I can run 'fetchenv /c/OSGeo4W/bin/o4w_env.bat' from my bash
> > terminal - and it starts the process, but it either is getting hung up,
> or
> > is just taking longer than I anticipated - is it something that does take
> > some time and I just need to let it run, so be patient? Or am I maybe
> > missing or need to adjust something else?
>
> Not sure - I use cygwin's bash and with that it works.  Other shells might
> behave differently.
>
> msys for instance has problems with plain /c in the cmd call and needs //c
> (see
> https://github.com/OSGeo/grass/blob/main/mswindows/osgeo4w/package.sh#L33)
>
> Try set -x to get some more insight what it does and where it hangs.  It
> might
> take a few seconds, but no minute.
>
>
> Jürgen
>
> --
> Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
> Software Engineer   D-26506 Norden
> https://www.norbit.de
> QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-07 Thread Jürgen E . Fischer via Qgis-user
Hi Mike,

On Thu, 07. Jul 2022 at 17:31:26 -0400, Mike Treglia wrote:
> So I've added the below to my profile (from the link you've previously
> shared), and I can run 'fetchenv /c/OSGeo4W/bin/o4w_env.bat' from my bash
> terminal - and it starts the process, but it either is getting hung up, or
> is just taking longer than I anticipated - is it something that does take
> some time and I just need to let it run, so be patient? Or am I maybe
> missing or need to adjust something else?

Not sure - I use cygwin's bash and with that it works.  Other shells might
behave differently.

msys for instance has problems with plain /c in the cmd call and needs //c (see
https://github.com/OSGeo/grass/blob/main/mswindows/osgeo4w/package.sh#L33)

Try set -x to get some more insight what it does and where it hangs.  It might
take a few seconds, but no minute.


Jürgen

-- 
Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
Software Engineer   D-26506 Nordenhttps://www.norbit.de
QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC


signature.asc
Description: PGP signature
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-07 Thread Mike Treglia via Qgis-user
Thanks again, Jürgen,

I appreciate the explanation - this is definitely an area where I can often
figure things out, but am still learning and fumbling my way through it a
bit.

So I've added the below to my profile (from the link you've previously
shared), and I can run 'fetchenv /c/OSGeo4W/bin/o4w_env.bat' from my bash
terminal - and it starts the process, but it either is getting hung up, or
is just taking longer than I anticipated - is it something that does take
some time and I just need to let it run, so be patient? Or am I maybe
missing or need to adjust something else?

If I try to suspend the process (ctrl + z) after a few minutes, I get a
message along these lines:
1 [sig] bash 471! sigpacket::process: Suppressing signal 18 to win32
process (pid 5648)

Then, I can kill that process, and then go through those steps (ctrl + z,
followed by killing the process) once more before it'll close out.

Best,
Mike

-- Code added to .profile
fetchenv() {
local IFS
IFS=
local batch=$1
shift

if ! [ -f "$batch" ]; then
echo "$batch not found"
return 1
fi

local d=$(mktemp -d /tmp/fetchenv.XX)
cmd /c set >$d/srcenv || true
cmd /c call $(cygpath -w $batch) "$@" \>nul 2\>\&1 \& set >$d/dstenv || true
sleep 2
cat <$d/envdiff
/^+++/d;
/^[^+]/d;
s/^+//;
# s///g;
/^PATH=/ {
s//\\//g;
s#\\([=;]\\)\\([a-zA-Z]\\):#\\1/cygdrive/\\2#g;
s/;/:/g;
}
s/;/;/g;
s/^/export /;
s/=/='/;
s/r//g;
s/\r$/'/;
EOF
diff -u $d/srcenv $d/dstenv | sed -f $d/envdiff >$d/diffenv
. $d/diffenv
PATH=$PATH:/bin:/usr/bin:$(cygpath --sysdir):$(cygpath --windir)
rm -fr $d || true
}

On Thu, Jul 7, 2022 at 12:41 PM Jürgen E. Fischer via Qgis-user <
qgis-user@lists.osgeo.org> wrote:

> Hi Mike,
>
> On Thu, 07. Jul 2022 at 12:20:52 -0400, Mike Treglia wrote:
> > I think I might be missing some of the knowledge I need to implement this
> > for now, which is alright. For example, I'm not sure where I should start
> > adjusting things in that portion of the build_helpers script, and
> > where/when I should run that, or if I'm should modify that portion of
> > build_helpers (ln 107-143) and insert that into
> /c/OSGeo4W/bin/o4w_env.bat,
> > such that the OSGeo4W.bat file will call on the desired environment.
>
> Sorry, I was implying that you're shell savy and pointers were enough.
> Copy fetchenv to your .profile and run it from there (or once you want to
> run
> osgeo4w stuff).
>
> …
> fetchenv() {
> …
> }
>
> fetchenv /c/OSGeo4W/bin/o4w_env.bat
> …
>
> It runs cmd to get a clean copy of the environment and once more with
> o4w_env.bat to get the updated version and then works out the differences,
> makes them shell digestable and sources them to the running shell.
>
> Also works with other software that provides batch files to update the
> environment (like msvc, strawberry perl, venvs in python - just to name
> the few
> the osgeo4w build scripts use it for).
>
>
> Jürgen
>
> --
> Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
> Software Engineer   D-26506 Norden
> https://www.norbit.de
> QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-07 Thread Jürgen E . Fischer via Qgis-user
Hi Mike,

On Thu, 07. Jul 2022 at 12:20:52 -0400, Mike Treglia wrote:
> I think I might be missing some of the knowledge I need to implement this
> for now, which is alright. For example, I'm not sure where I should start
> adjusting things in that portion of the build_helpers script, and
> where/when I should run that, or if I'm should modify that portion of
> build_helpers (ln 107-143) and insert that into /c/OSGeo4W/bin/o4w_env.bat,
> such that the OSGeo4W.bat file will call on the desired environment.

Sorry, I was implying that you're shell savy and pointers were enough.
Copy fetchenv to your .profile and run it from there (or once you want to run
osgeo4w stuff).

…
fetchenv() {
…   
}

fetchenv /c/OSGeo4W/bin/o4w_env.bat
…

It runs cmd to get a clean copy of the environment and once more with
o4w_env.bat to get the updated version and then works out the differences,
makes them shell digestable and sources them to the running shell.

Also works with other software that provides batch files to update the
environment (like msvc, strawberry perl, venvs in python - just to name the few
the osgeo4w build scripts use it for).


Jürgen

-- 
Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
Software Engineer   D-26506 Nordenhttps://www.norbit.de
QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC


signature.asc
Description: PGP signature
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-07 Thread Mike Treglia via Qgis-user
Thanks, Jürgen, for the quick response! Much appreciated!

I think I might be missing some of the knowledge I need to implement this
for now, which is alright. For example, I'm not sure where I should start
adjusting things in that portion of the build_helpers script, and
where/when I should run that, or if I'm should modify that portion of
build_helpers (ln 107-143) and insert that into /c/OSGeo4W/bin/o4w_env.bat,
such that the OSGeo4W.bat file will call on the desired environment.

Thus, I would definitely value any more insight/guidance on this, and I can
keep working with OSGeo4W in the existing setup for now too if I need
without issue - its honestly more of a convenience item than a necessity.

Thanks again!
Mike

On Thu, Jul 7, 2022 at 10:54 AM Jürgen E. Fischer via Qgis-user <
qgis-user@lists.osgeo.org> wrote:

> Hi Mike,
>
> On Thu, 07. Jul 2022 at 10:08:21 -0400, Mike Treglia via Qgis-user wrote:
> > I was hoping to use the OSGeo4W shell from a unix-style terminal - like
> git
> > bash or similar. For some things, in the past, I've added the directory
> > with binaries from the OSGeo4W install to my Windows Environment System
> > Variables for as a value in Path.
>
> Adapt fetchenv
> https://github.com/jef-n/OSGeo4W/blob/master/scripts/build-helpers#L107
> to your
> shell and fetchenv /c/OSGeo4W/bin/o4w_env.bat.  That way you should get all
> veriables the batch files setup into your environment.
>
>
> Jürgen
>
> --
> Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
> Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
> Software Engineer   D-26506 Norden
> https://www.norbit.de
> QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] OSGeo4W Shell with Unix-Style Terminal?

2022-07-07 Thread Jürgen E . Fischer via Qgis-user
Hi Mike,

On Thu, 07. Jul 2022 at 10:08:21 -0400, Mike Treglia via Qgis-user wrote:
> I was hoping to use the OSGeo4W shell from a unix-style terminal - like git
> bash or similar. For some things, in the past, I've added the directory
> with binaries from the OSGeo4W install to my Windows Environment System
> Variables for as a value in Path.

Adapt fetchenv
https://github.com/jef-n/OSGeo4W/blob/master/scripts/build-helpers#L107 to your
shell and fetchenv /c/OSGeo4W/bin/o4w_env.bat.  That way you should get all
veriables the batch files setup into your environment.


Jürgen

-- 
Jürgen E. Fischer   norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13  Fax. +49-4931-918175-50
Software Engineer   D-26506 Nordenhttps://www.norbit.de
QGIS release manager (PSC)  Germany IRC: jef on Libera|OFTC


signature.asc
Description: PGP signature
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user