Skip to content

Commit

Permalink
updated folder structure and optimize imports for the package
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi23root committed Apr 15, 2024
1 parent d3056ca commit ff69b09
Show file tree
Hide file tree
Showing 37 changed files with 167 additions and 883 deletions.
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,19 @@ Features
additional Utils
================

- saveFrames
- detectionBox
- show_all_frames

Detection Utils
===============

- face detection
- hand detection
- eye detection (yet to be added)

add code examples here for each feature and utilities

.. |GitHub stars| image:: https://img.shields.io/github/stars/rishi23root/opencv.wrap.svg
:target: https://github.com/rishi23root/opencv.wrap/stargazers
.. |PyPI| image:: https://img.shields.io/pypi/v/opencv.wrap.svg
Expand Down
58 changes: 34 additions & 24 deletions newBuild.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# flake8: noqa: E501
# create a new build for the project
import os,re
import os
import re


def updated_version(old_version):
# old_version = old_version.split('.')

major_release, minor_release, revision = (int(i) for i in old_version.split('.'))
major_release, minor_release, revision = (int(i) for i in old_version.split("."))
# if revision < 30:
# revision += 1
# else:
Expand All @@ -16,49 +19,56 @@ def updated_version(old_version):
# major_release += 1
revision += 1

return f'{major_release}.{minor_release}.{revision}'
return f"{major_release}.{minor_release}.{revision}"


# update the version in the setup.py file
with open('setup.py','r') as f:
with open("setup.py", "r") as f:
data = f.read()
# read the version number from the setup.py file
VERSION = re.search(r"VERSION='(.*?)'", data).group(1)
print('[info]', 'old version', VERSION)
FOLDER_NAME = re.search(r"name='(.*?)'", data).group(1)
print('[info]', 'FOLDER_NAME ', FOLDER_NAME)
VERSION = re.search(r'VERSION = "(.*?)"', data).group(1)
print("[info]", "old version", VERSION)

FOLDER_NAME = re.search(r'name="(.*?)"', data).group(1)
print("[info]", "FOLDER_NAME ", FOLDER_NAME)
# update the version number
NEW_VERSION = updated_version(VERSION)
print('[info]', 'new version', NEW_VERSION)
data = data.replace(f"VERSION='{VERSION}'",f"VERSION='{NEW_VERSION}'")
print("[info]", "new version", NEW_VERSION)
data = data.replace(f'VERSION = "{VERSION}"', f'VERSION = "{NEW_VERSION}"')
isUpdated = re.search(r'VERSION = "(.*?)"', data).group(1)
print("[info]", "updated version", isUpdated)


# update the package list
all_packages_old = re.search(r"install_requires=\[([\s\S]*?)\]", data).group(1)
# print(all_packages_old)
install_requires = [i.replace('\n','').replace('==','>=') for i in open('requirements.txt', 'r').readlines()]
data = data.replace(f"install_requires=[{all_packages_old}]",f"install_requires={install_requires}")
install_requires = [
i.replace("\n", "").replace("==", ">=")
for i in open("requirements.txt", "r").readlines()
]
data = data.replace(
f"install_requires=[{all_packages_old}]", f"install_requires={install_requires}"
)

with open('setup.py','w') as f:
with open("setup.py", "w") as f:
f.write(data)

# remove the old build from the dist folder
print('[info]', 'deleting old build',f'{os.getcwd()}/dist/{FOLDER_NAME}-{VERSION}.tar.gz')
os.system(f'rm {os.getcwd()}/dist/{FOLDER_NAME}-{VERSION}.tar.gz')
print(
"[info]", "deleting old build", f"{os.getcwd()}/dist/{FOLDER_NAME}-{VERSION}.tar.gz"
)
os.system(f"rm {os.getcwd()}/dist/{FOLDER_NAME}-{VERSION}.tar.gz")


# convert the README.md to README.rst
print('[info]', 'converting README.md to README.rst')
os.system('pandoc --from=markdown --to=rst --output=README.rst README.md')

print("[info]", "converting README.md to README.rst")
os.system("pandoc --from=markdown --to=rst --output=README.rst README.md")


# create a new build
print('[info]', 'creating new build')
os.system(f'python3 setup.py sdist')
print("[info]", "creating new build")
os.system(f"python3 setup.py sdist")

# upload to test pypi using twine
print('[info]', 'uploading to test pypi')
print("[info]", "uploading to test pypi")
# os.system(f'twine upload --repository testpypi dist/{FOLDER_NAME}-{NEW_VERSION}.tar.gz')
os.system(f'twine upload dist/{FOLDER_NAME}-{NEW_VERSION}.tar.gz')
os.system(f"twine upload dist/{FOLDER_NAME}-{NEW_VERSION}.tar.gz")
2 changes: 0 additions & 2 deletions opencv.wrap/__init__.py

This file was deleted.

Binary file removed opencv.wrap/test/1/test-img2.jfif
Binary file not shown.
Binary file removed opencv.wrap/test/1/test5.jfif
Binary file not shown.
4 changes: 0 additions & 4 deletions opencv.wrap/test/old/Face/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit ff69b09

Please sign in to comment.