[New] sysutils/autorandr

2020-10-17 Thread Ashton Fagg
This is a new port for autorandr. This is a simple-ish Python script
that wraps xrandr and lets you automate xrandr actions as you unplug
monitors etc.

Tested on my machine (amd64) running current. Port patches, builds and
installs successfully. Installed executable runs, `man autorandr` also
works.

Checkpatch is clean.

Any feedback greatly appreciated.

- ajf

diff --git a/sysutils/autorandr/Makefile b/sysutils/autorandr/Makefile
new file mode 100644
index 000..6b94a3e6cb8
--- /dev/null
+++ b/sysutils/autorandr/Makefile
@@ -0,0 +1,29 @@
+# $OpenBSD: Makefile,v 1.13 2019/11/10 16:25:41 kmos Exp $
+
+COMMENT=   automates xrandr calls based on connect devices
+
+MODPY_EGG_VERSION= 1.10.1
+DISTNAME=  autorandr-${MODPY_EGG_VERSION}
+CATEGORIES=sysutils
+
+GH_ACCOUNT=phillipberndt
+GH_PROJECT=autorandr
+GH_TAGNAME=${MODPY_EGG_VERSION}
+
+# GPLv3
+PERMIT_PACKAGE=Yes
+
+MAINTAINER=Ashton Fagg 
+
+MODULES=   lang/python
+MODPY_SETUPTOOLS = Yes
+
+# No tests provided by upstream.
+NO_TEST=   Yes
+
+do-install:
+   ${INSTALL_PROGRAM} ${WRKSRC}/autorandr.py ${PREFIX}/bin/autorandr
+   ${INSTALL_MAN} ${WRKSRC}/autorandr.1 ${PREFIX}/man/man1/autorandr.1
+
+
+.include 
diff --git a/sysutils/autorandr/distinfo b/sysutils/autorandr/distinfo
new file mode 100644
index 000..b1bbff68d4b
--- /dev/null
+++ b/sysutils/autorandr/distinfo
@@ -0,0 +1,2 @@
+SHA256 (autorandr-1.10.1.tar.gz) = Iw+589W/VEolR8Advdo5gSlEzdVGWmebuWF2nH3bVSw=
+SIZE (autorandr-1.10.1.tar.gz) = 48043
diff --git a/sysutils/autorandr/patches/patch-autorandr_py 
b/sysutils/autorandr/patches/patch-autorandr_py
new file mode 100644
index 000..0823effa05c
--- /dev/null
+++ b/sysutils/autorandr/patches/patch-autorandr_py
@@ -0,0 +1,11 @@
+$OpenBSD$
+
+Index: autorandr.py
+--- autorandr.py.orig
 autorandr.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ # encoding: utf-8
+ #
+ # autorandr.py
diff --git a/sysutils/autorandr/pkg/DESCR b/sysutils/autorandr/pkg/DESCR
new file mode 100644
index 000..770c46b8094
--- /dev/null
+++ b/sysutils/autorandr/pkg/DESCR
@@ -0,0 +1 @@
+Automates xrandr actions.
diff --git a/sysutils/autorandr/pkg/PLIST b/sysutils/autorandr/pkg/PLIST
new file mode 100644
index 000..2e887db21a3
--- /dev/null
+++ b/sysutils/autorandr/pkg/PLIST
@@ -0,0 +1,3 @@
+@comment $OpenBSD: PLIST,v$
+bin/autorandr
+@man man/man1/autorandr.1



Re: [New] sysutils/autorandr

2020-10-17 Thread Klemens Nanni
On Sat, Oct 17, 2020 at 09:36:34PM -0400, Ashton Fagg wrote:
> This is a new port for autorandr. This is a simple-ish Python script
> that wraps xrandr and lets you automate xrandr actions as you unplug
> monitors etc.
> 
> Tested on my machine (amd64) running current. Port patches, builds and
> installs successfully. Installed executable runs, `man autorandr` also
> works.
> 
> Checkpatch is clean.
Do you mean portcheck(1)?

> Any feedback greatly appreciated.
Please submit new ports as tarball of the ports directory.

> --- /dev/null
> +++ b/sysutils/autorandr/Makefile
> @@ -0,0 +1,29 @@
> +# $OpenBSD: Makefile,v 1.13 2019/11/10 16:25:41 kmos Exp $
> +
> +COMMENT= automates xrandr calls based on connect devices
> +
> +MODPY_EGG_VERSION= 1.10.1
You can merge that right into GH_TAGNAME.

> +DISTNAME=autorandr-${MODPY_EGG_VERSION}
GH_* sets DISTNAME and PKGNAME automatically so only set them manually
when required (not here).

> +CATEGORIES=  sysutils
"x11" could do as second category.

> +
> +GH_ACCOUNT=phillipberndt
> +GH_PROJECT=autorandr
> +GH_TAGNAME=${MODPY_EGG_VERSION}
> +
> +# GPLv3
> +PERMIT_PACKAGE=  Yes
> +
> +MAINTAINER=Ashton Fagg 
> +
> +MODULES= lang/python
> +MODPY_SETUPTOOLS = Yes
New ports should be using Python 3, i.e.
MODPY_VERSION=  ${MODPY_DEFAULT_VERSION_3}

> --- /dev/null
> +++ b/sysutils/autorandr/patches/patch-autorandr_py
> @@ -0,0 +1,11 @@
> +$OpenBSD$
> +
> +Index: autorandr.py
> +--- autorandr.py.orig
>  autorandr.py
> +@@ -1,4 +1,4 @@
> +-#!/usr/bin/env python
> ++#!/usr/bin/env python2
Use MODPY_ADJ_FILES, see port-modules(5).

> --- /dev/null
> +++ b/sysutils/autorandr/pkg/DESCR
> @@ -0,0 +1 @@
> +Automates xrandr actions.
This is not a description, even COMMENT contains more information.
Please be more elaborate so that `pkg_info autorandr' will tell users
what to expect from this package before they install it.



Re: [New] sysutils/autorandr

2020-10-17 Thread Ashton Fagg
Klemens Nanni  writes:

>> Checkpatch is clean.
> Do you mean portcheck(1)?

Yes, sorry.

>> Any feedback greatly appreciated.
> Please submit new ports as tarball of the ports directory.

Noted.

The rest I will work on and resubmit. Thanks for the review.

- ajf



Re: [New] sysutils/autorandr

2020-11-03 Thread Ashton Fagg
Finally getting back to this, I have addressed the review comments from
Klemens below.

Updated version of the port attached as tarball.

Package builds correctly. I installed it on my machine and it seems to
be working as expected (talking to xrandr as it should) - I have only
tested this on amd64. Portcheck is again clean.

Comments on what specifically changed since intial review below. Any
suggestions appreciated.

Thanks again Klemens for the initial review.



autorandr-1.10.1.tgz
Description: Binary data

Klemens Nanni  writes:

>> --- /dev/null
>> +++ b/sysutils/autorandr/Makefile
>> @@ -0,0 +1,29 @@
>> +# $OpenBSD: Makefile,v 1.13 2019/11/10 16:25:41 kmos Exp $
>> +
>> +COMMENT=automates xrandr calls based on connect devices
>> +
>> +MODPY_EGG_VERSION= 1.10.1
> You can merge that right into GH_TAGNAME.

Done.

>> +DISTNAME=   autorandr-${MODPY_EGG_VERSION}
> GH_* sets DISTNAME and PKGNAME automatically so only set them manually
> when required (not here).

Done.

>> +CATEGORIES= sysutils
> "x11" could do as second category.

Done. Maybe it's better as the primary category, on reflection?

>> +
>> +GH_ACCOUNT=phillipberndt
>> +GH_PROJECT=autorandr
>> +GH_TAGNAME=${MODPY_EGG_VERSION}
>> +
>> +# GPLv3
>> +PERMIT_PACKAGE= Yes
>> +
>> +MAINTAINER=Ashton Fagg 
>> +
>> +MODULES=lang/python
>> +MODPY_SETUPTOOLS = Yes
> New ports should be using Python 3, i.e.
> MODPY_VERSION=${MODPY_DEFAULT_VERSION_3}

Addressed. I also changed the Makefile to use MODPY_ADJ_FILES, so I am
not sure if the Python shebang needs to patched now...

(Sorry, I am new to this).

>> --- /dev/null
>> +++ b/sysutils/autorandr/patches/patch-autorandr_py
>> @@ -0,0 +1,11 @@
>> +$OpenBSD$
>> +
>> +Index: autorandr.py
>> +--- autorandr.py.orig
>>  autorandr.py
>> +@@ -1,4 +1,4 @@
>> +-#!/usr/bin/env python
>> ++#!/usr/bin/env python2
> Use MODPY_ADJ_FILES, see port-modules(5).

Addressed, see above.

>> --- /dev/null
>> +++ b/sysutils/autorandr/pkg/DESCR
>> @@ -0,0 +1 @@
>> +Automates xrandr actions.
> This is not a description, even COMMENT contains more information.
> Please be more elaborate so that `pkg_info autorandr' will tell users
> what to expect from this package before they install it.

I have elaborated more in the attached version.


Re: [New] sysutils/autorandr

2020-11-04 Thread Stuart Henderson
Updated version attaached:

- whitespace fixes

- while you had MODPY_SETUPTOOLS set you were overriding do-install so it
didn't actually use the things setuptools did. change that to actually use
setuptools, which sets #! lines etc for you and generates egg-info files,
get rid of the patch / MODPY_ADJ_FILES

- set MODPY_EGG_VERSION should be the string in the site-packages egg-info
lines i.e. they should look like autorandr-${MODPY_EGG_VERSION}-py

- i think x11 probably is better than sysutils though i am not wedded to that

On 2020/11/03 14:04, Ashton Fagg wrote:
> Finally getting back to this, I have addressed the review comments from
> Klemens below.
> 
> Updated version of the port attached as tarball.
> 
> Package builds correctly. I installed it on my machine and it seems to
> be working as expected (talking to xrandr as it should) - I have only
> tested this on amd64. Portcheck is again clean.
> 
> Comments on what specifically changed since intial review below. Any
> suggestions appreciated.
> 
> Thanks again Klemens for the initial review.
> 


> 
> Klemens Nanni  writes:
> 
> >> --- /dev/null
> >> +++ b/sysutils/autorandr/Makefile
> >> @@ -0,0 +1,29 @@
> >> +# $OpenBSD: Makefile,v 1.13 2019/11/10 16:25:41 kmos Exp $
> >> +
> >> +COMMENT=  automates xrandr calls based on connect devices
> >> +
> >> +MODPY_EGG_VERSION= 1.10.1
> > You can merge that right into GH_TAGNAME.
> 
> Done.
> 
> >> +DISTNAME= autorandr-${MODPY_EGG_VERSION}
> > GH_* sets DISTNAME and PKGNAME automatically so only set them manually
> > when required (not here).
> 
> Done.
> 
> >> +CATEGORIES=   sysutils
> > "x11" could do as second category.
> 
> Done. Maybe it's better as the primary category, on reflection?
> 
> >> +
> >> +GH_ACCOUNT=phillipberndt
> >> +GH_PROJECT=autorandr
> >> +GH_TAGNAME=${MODPY_EGG_VERSION}
> >> +
> >> +# GPLv3
> >> +PERMIT_PACKAGE=   Yes
> >> +
> >> +MAINTAINER=Ashton Fagg 
> >> +
> >> +MODULES=  lang/python
> >> +MODPY_SETUPTOOLS = Yes
> > New ports should be using Python 3, i.e.
> > MODPY_VERSION=  ${MODPY_DEFAULT_VERSION_3}
> 
> Addressed. I also changed the Makefile to use MODPY_ADJ_FILES, so I am
> not sure if the Python shebang needs to patched now...
> 
> (Sorry, I am new to this).
> 
> >> --- /dev/null
> >> +++ b/sysutils/autorandr/patches/patch-autorandr_py
> >> @@ -0,0 +1,11 @@
> >> +$OpenBSD$
> >> +
> >> +Index: autorandr.py
> >> +--- autorandr.py.orig
> >>  autorandr.py
> >> +@@ -1,4 +1,4 @@
> >> +-#!/usr/bin/env python
> >> ++#!/usr/bin/env python2
> > Use MODPY_ADJ_FILES, see port-modules(5).
> 
> Addressed, see above.
> 
> >> --- /dev/null
> >> +++ b/sysutils/autorandr/pkg/DESCR
> >> @@ -0,0 +1 @@
> >> +Automates xrandr actions.
> > This is not a description, even COMMENT contains more information.
> > Please be more elaborate so that `pkg_info autorandr' will tell users
> > what to expect from this package before they install it.
> 
> I have elaborated more in the attached version.



autorandr.tgz
Description: application/tar-gz


Re: [New] sysutils/autorandr

2020-11-04 Thread Klemens Nanni
On Wed, Nov 04, 2020 at 03:28:09PM +, Stuart Henderson wrote:
> Updated version attaached:
Thanks, I had some of thoes but didn't come around to mail it, but you
did a better job anyway.

> - whitespace fixes
> 
> - while you had MODPY_SETUPTOOLS set you were overriding do-install so it
> didn't actually use the things setuptools did. change that to actually use
> setuptools, which sets #! lines etc for you and generates egg-info files,
> get rid of the patch / MODPY_ADJ_FILES
> 
> - set MODPY_EGG_VERSION should be the string in the site-packages egg-info
> lines i.e. they should look like autorandr-${MODPY_EGG_VERSION}-py
OK kn

> - i think x11 probably is better than sysutils though i am not wedded to that
Yup, can just add syysutils as secondary as well.



Re: [New] sysutils/autorandr

2020-11-04 Thread Ashton Fagg
Klemens Nanni  writes:

> On Wed, Nov 04, 2020 at 03:28:09PM +, Stuart Henderson wrote:
>> Updated version attaached:
> Thanks, I had some of thoes but didn't come around to mail it, but you
> did a better job anyway.
>
>> - whitespace fixes
>> 
>> - while you had MODPY_SETUPTOOLS set you were overriding do-install so it
>> didn't actually use the things setuptools did. change that to actually use
>> setuptools, which sets #! lines etc for you and generates egg-info files,
>> get rid of the patch / MODPY_ADJ_FILES
>> 
>> - set MODPY_EGG_VERSION should be the string in the site-packages egg-info
>> lines i.e. they should look like autorandr-${MODPY_EGG_VERSION}-py
> OK kn
>
>> - i think x11 probably is better than sysutils though i am not wedded to that
> Yup, can just add syysutils as secondary as well.

Stuart/Klemens,

Thank you both for the reviews and suggestions, I'm learning a lot
here. I think x11 as the category makes more sense than sysutils on
reflection.

Ash