[neon/neon-packaging/selenium-webdriver-at-spi/Neon/unstable_jammy] debian: new attempt at venv

Carlos De Maine null at kde.org
Mon Jun 10 09:19:57 BST 2024


Git commit c3dcfe82a9b595b8b32b80e7d50c408d1c42dd86 by Carlos De Maine.
Committed on 10/06/2024 at 08:19.
Pushed by carlosdem into branch 'Neon/unstable_jammy'.

new attempt at venv

M  +76   -16   debian/patches/virtenv.diff
M  +6    -13   debian/rules
M  +2    -2    debian/selenium-webdriver-at-spi.links

https://invent.kde.org/neon/neon-packaging/selenium-webdriver-at-spi/-/commit/c3dcfe82a9b595b8b32b80e7d50c408d1c42dd86

diff --git a/debian/patches/virtenv.diff b/debian/patches/virtenv.diff
index fc2ab97..efa9a0e 100644
--- a/debian/patches/virtenv.diff
+++ b/debian/patches/virtenv.diff
@@ -1,24 +1,16 @@
-6a2b8c7481306c888afd82ead1f8ba1a8fe53269
- CMakeLists.txt |  5 ++++-
- setup.py       | 14 ++++++++++++++
- 2 files changed, 18 insertions(+), 1 deletion(-)
-
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 295e9fc..0871454 100644
+index 94f640aca700b10360a6fec237e6bad5a88383a1..1d6fa9cb252c70abec7995175ddec67c53066c0c 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -59,7 +59,9 @@ add_subdirectory(videorecorder)
- install(PROGRAMS run.rb
+@@ -60,6 +60,7 @@ install(PROGRAMS run.rb
      RENAME selenium-webdriver-at-spi-run
      DESTINATION ${CMAKE_INSTALL_BINDIR})
--install(FILES selenium-webdriver-at-spi.py app_roles.py requirements.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/selenium-webdriver-at-spi)
-+install(FILES requirements.txt  DESTINATION ${CMAKE_INSTALL_DATADIR}/selenium-webdriver-at-spi)
-+#install(FILES selenium-webdriver-at-spi.py app_roles.py requirements.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/selenium-webdriver-at-spi)
+ install(FILES selenium-webdriver-at-spi.py app_roles.py requirements.txt DESTINATION ${CMAKE_INSTALL_DATADIR}/selenium-webdriver-at-spi)
 +install(FILES examples/calculatortest.py examples/kinfocentertest.rb DESTINATION ${CMAKE_INSTALL_DATADIR}/selenium-webdriver-at-spi/examples)
-
+ 
  set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/SeleniumWebDriverATSPI")
-
-@@ -79,6 +81,7 @@ install(
+ 
+@@ -79,6 +80,7 @@ install(
          cmake/FindPythonModule.cmake.in
          cmake/FindRuby.cmake
          cmake/ProgramFinder.cmake
@@ -26,9 +18,77 @@ index 295e9fc..0871454 100644
      DESTINATION ${CMAKECONFIG_INSTALL_DIR}
      COMPONENT Devel
  )
+diff --git a/run.rb b/run.rb
+index 2e6137802fc992d5ef0cd91fd5074b9f73ebce0f..69d1adde7be093e06ebf87b6c5164b82520bb64f 100755
+--- a/run.rb
++++ b/run.rb
+@@ -205,26 +205,48 @@ PORT = '4723'
+ $stdout.sync = true # force immediate flushing without internal caching
+ logger = Logger.new($stdout)
+ 
++# Tweak the CIs logging rules. They are way too verbose for our purposes
++if ENV['KDECI_BUILD'] == 'TRUE'
++  ENV['QT_LOGGING_RULES'] = <<-RULES.gsub(/\s/, '')
++    default=true;*.debug=true;kf.globalaccel.kglobalacceld=false;kf.wayland.client=false;
++    qt.scenegraph.*=false;qt.qml.diskcache=false;
++    qt.qml.*=false;qt.qpa.wayland.*=false;qt.quick.dirty=false;qt.accessibility.cache=false;qt.v4.asm=false;
++    qt.opengl.diskcache=false;qt.qpa.fonts=false;kf.kio.workers.http=false;
++    qt.quick.*=false;qt.text.*=false;qt.qpa.input.methods=false;
++    qt.qpa.backingstore=false;qt.gui.*=false;qt.core.plugin.loader=false;
++  RULES
++  ENV['QT_LOGGING_RULES'] = ENV['QT_LOGGING_RULES_OVERRIDE'] if ENV.include?('QT_LOGGING_RULES_OVERRIDE')
++end
++
+ logger.info 'Installing dependencies'
++logger.info "Virtenv Name is #{ENV['VIRTUAL_ENV_PROMPT']}"
++
+ datadir = File.absolute_path("#{__dir__}/../share/selenium-webdriver-at-spi/")
+-requirements_installed_marker = "#{Dir.tmpdir}/selenium-requirements-installed"
+-if !File.exist?(requirements_installed_marker) && File.exist?("#{datadir}/requirements.txt")
+-  raise 'pip3 not found in PATH!' unless system('which', 'pip3')
+-  unless system('pip3', 'install', '-r', 'requirements.txt', chdir: datadir)
+-    unless system('pip3', 'install', '--break-system-packages', '-r', 'requirements.txt', chdir: datadir)
+-      raise 'Failed to run pip3 install!'
+-    end
+-  end
+ 
+-  if ENV['KDECI_BUILD'] == 'TRUE'
+-    File.open(requirements_installed_marker, "w") do |file|
+-      # create an empty file so tests in the same CI container can skip the process
+-    end
+-  end
++if ENV.include?('VIRTUAL_ENV_PROMPT') #== 'selenium-webdriver-at-spi'
++	logger.info 'We are in a virtenv, no pip upgrades and set appropriate PATH'
++	#	system('pip3', 'install', '--user', '-r', 'requirements.txt', chdir: datadir)
++	ENV['PATH'] = "#{ENV['VIRTUAL_ENV']}:#{ENV.fetch('PATH')}"
++	logger.info "path is now #{ENV['PATH']}"
++else
++	requirements_installed_marker = "#{Dir.tmpdir}/selenium-requirements-installed"
++	if !File.exist?(requirements_installed_marker) && File.exist?("#{datadir}/requirements.txt")
++		raise 'pip3 not found in PATH!' unless system('which', 'pip3')
++		unless system('pip3', 'install', '--user', '-r', 'requirements.txt', chdir: datadir)
++		unless system('pip3', 'install', '--user', '--break-system-packages', '-r', 'requirements.txt', chdir: datadir)
++				raise 'Failed to run pip3 install!'
++			end
++		end
++
++		if ENV['KDECI_BUILD'] == 'TRUE'
++			File.open(requirements_installed_marker, "w") do |file|
++				# create an empty file so tests in the same CI container can skip the process
++			end
++		end
++	end
++	ENV['PATH'] = "#{Dir.home}/.local/bin:#{ENV.fetch('PATH')}"
+ end
+ 
+-ENV['PATH'] = "#{Dir.home}/.local/bin:#{ENV.fetch('PATH')}"
+-
+ ret = false
+ 
+ # create a throw-away XDG home, so the test starts with a clean slate
 diff --git a/setup.py b/setup.py
 new file mode 100644
-index 0000000..e68d3c6
+index 0000000000000000000000000000000000000000..1136c8455ff6ae930586325e471db57149c49122
 --- /dev/null
 +++ b/setup.py
 @@ -0,0 +1,14 @@
@@ -44,5 +104,5 @@ index 0000000..e68d3c6
 +        packages=find_packages(),
 +        python_requires=">=3.8",
 +        scripts=['app_roles.py', 'selenium-webdriver-at-spi.py'],
-+        install_requires=["pycairo", "pygobject"]
++		 install_requires=["pycairo", "pygobject", "flask", "lxml", "Appium_Python_Client", "selenium"]
 +	)
diff --git a/debian/rules b/debian/rules
index f278d0e..6a0b74f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,28 +3,21 @@
 # SPDX-FileCopyrightText: 2023 Jonathan Riddell <jr at jriddell.org>
 
 export DH_VERBOSE=1
-export DH_VIRTUALENV_INSTALL_ROOT=/usr/lib/
+export DH_VIRTUALENV_INSTALL_ROOT=/opt/
 
 PACKAGE=$(shell dh_listpackages)
 DH_VENV_DIR=debian/$(PACKAGE)$(DH_VIRTUALENV_INSTALL_ROOT)/$(PACKAGE)
 
-
-#	dh $@ --with kf6 --buildsystem kf6
-
-#override_dh_auto_configure:
-#	pip install -U --upgrade-strategy eager -r requirements.txt
-#	dh_auto_configure
-
-#	override_dh_auto_test:
-#	:
-
 %:
-	dh $@ --buildsystem=pybuild --with python-virtualenv --use-system-packages --no-test --with kf6 --buildsystem kf6
+	dh $@ --buildsystem=pybuild --with python-virtualenv --use-system-packages --with kf6 --buildsystem kf6
 
 override_dh_virtualenv:
-	dh_virtualenv --python=python3
+	dh_virtualenv --python=python3 --use-system-packages
 	$(DH_VENV_DIR)/bin/python $(DH_VENV_DIR)/bin/pip install -U --upgrade-strategy eager -r requirements.txt
 	. $(DH_VENV_DIR)/bin/activate \
 	&& ls -ls && dh_auto_configure -- -DQT_MAJOR_VERSION=6 -DBUILD_WITH_QT6=ON \
 	&& dh_auto_build \
 	&& dh_auto_install
+
+override_dh_auto_test:
+	:
diff --git a/debian/selenium-webdriver-at-spi.links b/debian/selenium-webdriver-at-spi.links
index 4a87dcb..d195c18 100644
--- a/debian/selenium-webdriver-at-spi.links
+++ b/debian/selenium-webdriver-at-spi.links
@@ -1,2 +1,2 @@
-usr/lib/selenium-webdriver-at-spi/bin/app_roles.py /usr/share/selenium-webdriver-at-spi/app_roles.py
-usr/lib/selenium-webdriver-at-spi/bin/selenium-webdriver-at-spi.py /usr/share/selenium-webdriver-at-spi/selenium-webdriver-at-spi.py
+#opt/selenium-webdriver-at-spi/bin/app_roles.py /usr/share/selenium-webdriver-at-spi/app_roles.py
+#opt/selenium-webdriver-at-spi/bin/selenium-webdriver-at-spi.py /usr/share/selenium-webdriver-at-spi/selenium-webdriver-at-spi.py


More information about the Neon-commits mailing list