This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 07a3903fda fix(plc4py): change from using poetry to setuptools
07a3903fda is described below

commit 07a3903fda0178f7685413cdf33b6005d60c354b
Author: Ben Hutcheson <[email protected]>
AuthorDate: Sat Apr 23 05:58:11 2022 +1000

    fix(plc4py): change from using poetry to setuptools
    
    * Created setup.py to use with pip-tools
    
    * Updated plc4py/pom.xml to use pipenv
    
    * Replace default topic in setup.py
    
    * Remove Pipfile from being tracked
    
    * Update pom.xml to use venv to build
    
    * Change dist folder to target
    
    * Updated venv bin directory detection
    
    * Removed poetry dependency check
    
    * Add maven clean plugin to plc4py
    
    * maven clean plugin version property
    
    * Updated version numbe to 0.10a0. PEP440
    
    Co-authored-by: hutcheb <[email protected]>
---
 .gitignore                               |  2 +
 pom.xml                                  |  8 ++-
 sandbox/plc4py/pom.xml                   | 95 ++++++++++++++++++++++++++++----
 sandbox/plc4py/pyproject.toml            | 44 ---------------
 sandbox/plc4py/setup.cfg                 | 22 ++++++++
 sandbox/plc4py/setup.py                  | 57 +++++++++++++++++++
 src/main/script/prerequisiteCheck.groovy | 34 +-----------
 7 files changed, 174 insertions(+), 88 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9936559c31..46be4cf264 100644
--- a/.gitignore
+++ b/.gitignore
@@ -99,6 +99,8 @@ plc4py/venv/
 **/__pycache__/**/*
 /plc4cpp/.vscode/ipch
 *.egg-info
+**/Pipfile.lock
+**/Pipfile
 
 # Exclude gradle stuff
 .gradle
diff --git a/pom.xml b/pom.xml
index 0be04a4f27..7b7d9f054a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -150,6 +150,7 @@
     <junit.jupiter.version>5.8.2</junit.jupiter.version>
     <junit.platform.version>1.8.2</junit.platform.version>
     <logback.version>1.2.10</logback.version>
+    <maven.clean.plugin.version>3.2.0</maven.clean.plugin.version>
     <milo.version>0.6.3</milo.version>
     <mockito.version>4.4.0</mockito.version>
     <netty.version>4.1.75.Final</netty.version>
@@ -791,7 +792,8 @@
             <!-- Python related files -->
             <exclude>**/.pytest_cache/**</exclude>
             <exclude>**/.mypy_cache/**</exclude>
-            <exclude>**/poetry.lock</exclude>
+            <exclude>**/Pipfile</exclude>
+            <exclude>**/Pipfile.lock</exclude>
 
             <!-- Eclipse related files -->
             <exclude>**/.project</exclude>
@@ -1601,6 +1603,7 @@
         
<cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-linux-x86_64.tar.gz</cmake.url>
         
<cmake.root>${project.build.directory}/cmake-${cmake-version}-linux-x86_64/bin/</cmake.root>
         <cmake.generator>Unix Makefiles</cmake.generator>
+        <python.venv.bin>venv/bin/</python.venv.bin>
       </properties>
     </profile>
     <profile>
@@ -1617,6 +1620,7 @@
         
<cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-linux-${os.arch}.tar.gz</cmake.url>
         
<cmake.root>${project.build.directory}/cmake-${cmake-version}-linux-${os.arch}/bin/</cmake.root>
         <cmake.generator>Unix Makefiles</cmake.generator>
+        <python.venv.bin>venv/bin/</python.venv.bin>
       </properties>
     </profile>
     <!-- Profile for mac (Self-Enabling) -->
@@ -1633,6 +1637,7 @@
         
<cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-macos-universal.tar.gz</cmake.url>
         
<cmake.root>${project.build.directory}/cmake-${cmake-version}-macos-universal/CMake.app/Contents/bin</cmake.root>
         <cmake.generator>Unix Makefiles</cmake.generator>
+        <python.venv.bin>venv/bin/</python.venv.bin>
       </properties>
     </profile>
     <!-- profile for windows (Self-Enabling) -->
@@ -1649,6 +1654,7 @@
         
<cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-windows-x86_64.zip</cmake.url>
         
<cmake.root>${project.build.directory}/cmake-${cmake-version}-windows-x86_64/bin</cmake.root>
         <cmake.generator>MinGW Makefiles</cmake.generator>
+        <python.venv.bin>venv/Scripts/</python.venv.bin>
       </properties>
     </profile>
 
diff --git a/sandbox/plc4py/pom.xml b/sandbox/plc4py/pom.xml
index 65d7eb8c7a..2ddcda1dfe 100644
--- a/sandbox/plc4py/pom.xml
+++ b/sandbox/plc4py/pom.xml
@@ -78,6 +78,22 @@
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
         <executions>
+          <execution>
+            <id>python-venv</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>python</executable>
+              <arguments>
+                <argument>-m</argument>
+                <argument>venv</argument>
+                <argument> ./venv</argument>
+              </arguments>
+            </configuration>
+          </execution>
+
           <execution>
             <id>python-install</id>
             <phase>compile</phase>
@@ -85,37 +101,96 @@
               <goal>exec</goal>
             </goals>
             <configuration>
-              <executable>poetry</executable>
+              <executable>${python.venv.bin}pip</executable>
               <arguments>
                 <argument>install</argument>
+                <argument>.</argument>
               </arguments>
             </configuration>
           </execution>
-        </executions>
-      </plugin>
 
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>exec-maven-plugin</artifactId>
-        <executions>
           <execution>
-            <id>python-test</id>
+            <id>python-test-compile</id>
             <phase>test-compile</phase>
             <goals>
               <goal>exec</goal>
             </goals>
             <configuration>
-              <executable>poetry</executable>
+              <executable>${python.venv.bin}pip</executable>
               <arguments>
-                <argument>run</argument>
+                <argument>install</argument>
+                <argument>.[dev]</argument>
+              </arguments>
+            </configuration>
+          </execution>
+
+          <execution>
+            <id>python-test</id>
+            <phase>test</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>${python.venv.bin}python</executable>
+              <arguments>
+                <argument>-m</argument>
                 <argument>pytest</argument>
                 <argument>-v</argument>
                 <argument>tests</argument>
               </arguments>
             </configuration>
           </execution>
+
+          <execution>
+            <id>python-package</id>
+            <phase>package</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <executable>${python.venv.bin}pip</executable>
+              <arguments>
+                <argument>wheel</argument>
+                <argument>.</argument>
+                <argument>-w</argument>
+                <argument>dist</argument>
+                <argument>--no-deps</argument>
+              </arguments>
+            </configuration>
+          </execution>
+
         </executions>
       </plugin>
+
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>${maven.clean.plugin.version}</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>venv</directory>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+            <fileset>
+              <directory>dist</directory>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+            <fileset>
+              <directory>.pytest_cache</directory>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+            <fileset>
+              <directory>plc4py.egg-info</directory>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+            <fileset>
+              <directory>build</directory>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+
       </plugins>
   </build>
 
diff --git a/sandbox/plc4py/pyproject.toml b/sandbox/plc4py/pyproject.toml
deleted file mode 100644
index 49167d1b9d..0000000000
--- a/sandbox/plc4py/pyproject.toml
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-
-[tool.poetry]
-name = "plc4py"
-version = "0.1.0"
-description = "Implementation of the Apache PLC4X project for Python"
-license = "Apache-2.0"
-authors = ["Apache PLC4X <[email protected]>"]
-
-[tool.poetry.dependencies]
-python = "^3.8"
-pytest-asyncio = "^0.18.3"
-
-[tool.poetry.dev-dependencies]
-pre-commit = "^2.6.0"
-pytest-mock = "^3.3.1"
-mock = "^4.0.2"
-mypy = "^0.942"
-flake8 = "^4.0.1"
-
-[build-system]
-requires = ["poetry-core>=1.0.0"]
-build-backend = "poetry.masonry.api"
-
-[tool.pytest.ini_options]
-asyncio_mode = "strict"
-
-[tool.poetry.plugins."plc4py.drivers"]
-"modbus" = "plc4py.drivers.modbus.ModbusConnection:ModbusConnectionLoader"
diff --git a/sandbox/plc4py/setup.cfg b/sandbox/plc4py/setup.cfg
new file mode 100644
index 0000000000..3bc8d916ad
--- /dev/null
+++ b/sandbox/plc4py/setup.cfg
@@ -0,0 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+[tool:pytest]
+testpaths = tests
+asyncio_mode=auto
\ No newline at end of file
diff --git a/sandbox/plc4py/setup.py b/sandbox/plc4py/setup.py
new file mode 100644
index 0000000000..9bb84aa512
--- /dev/null
+++ b/sandbox/plc4py/setup.py
@@ -0,0 +1,57 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+from setuptools import setup, find_packages
+
+setup(
+    name="plc4py",
+    version="0.10a0",
+    description="Plc4py The Python Industrial IOT Adapter",
+    classifiers=[
+        "Development Status :: 3 - Alpha",
+        "License :: OSI Approved :: Apache 2.0 License",
+        "Programming Language :: Python :: 3.8",
+        "Topic :: Scientific/Engineering :: Interface Engine/Protocol 
Translator",
+    ],
+    keywords="modbus plc4x",
+    url="https://plc4x.apache.org";,
+    author='"Apache PLC4X <>"',
+    author_email="[email protected]",
+    license="Apache 2.0",
+    packages=find_packages(include=["plc4py", "plc4py.*"]),
+    install_requires=[
+        "pytest-asyncio>=0.18.3",
+        "pip-tools",
+    ],
+    extras_require={
+        "dev": [
+            "requires",
+            "pre-commit>=2.6.0",
+            "pytest-mock>=3.3.1",
+            "mock>=4.0.2",
+            "mypy>=0.942",
+            "flake8>=4.0.1",
+        ]
+    },
+    entry_points={
+        "plc4py.drivers": [
+            "modbus = 
plc4py.drivers.modbus.ModbusConnection:ModbusConnectionLoader"
+        ]
+    },
+)
diff --git a/src/main/script/prerequisiteCheck.groovy 
b/src/main/script/prerequisiteCheck.groovy
index e9d2098937..c87b44c265 100644
--- a/src/main/script/prerequisiteCheck.groovy
+++ b/src/main/script/prerequisiteCheck.groovy
@@ -319,38 +319,7 @@ def checkPython() {
         Matcher matcher = extractVersion(stdOut + stdErr)
         if (matcher.size() > 0) {
             def curVersion = matcher[0][1]
-            def result = checkVersionAtLeast(curVersion, "2.7.0")
-            if (!result) {
-                allConditionsMet = false
-            }
-        } else {
-            println "missing (Please install at least version 3.6.0)"
-            allConditionsMet = false
-        }
-    } catch (Exception e) {
-        println "missing"
-        allConditionsMet = false
-    }
-}
-
-def checkPoetry(boolean isWin) {
-    print "Detecting Poetry version:  "
-    try {
-        def process
-        if (isWin) {
-            process = ("poetry.bat --version").execute()
-        } else {
-            process = ("poetry --version").execute()
-        }
-
-        def stdOut = new StringBuilder()
-        def stdErr = new StringBuilder()
-        process.consumeProcessOutput(stdOut, stdErr)
-        process.waitForOrKill(500)
-        Matcher matcher = extractVersion(stdOut + stdErr)
-        if (matcher.size() > 0) {
-            def curVersion = matcher[0][1]
-            def result = checkVersionAtLeast(curVersion, "1.0.0")
+            def result = checkVersionAtLeast(curVersion, "3.6.0")
             if (!result) {
                 allConditionsMet = false
             }
@@ -593,7 +562,6 @@ if (cppEnabled) {
 
 if (pythonEnabled) {
     checkPython()
-    checkPoetry(os == "windows")
     checkSetupTools()
 }
 

Reply via email to