dircomply 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dircomply-0.1/PKG-INFO ADDED
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: dircomply
3
+ Version: 0.1
4
+ Summary: A small package to compare the files between two project folders.
5
+ Author: Benevant Mathew
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Natural Language :: English
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Topic :: Utilities
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+
16
+ dircomply compares two folders for there differences in these extensions files - .txt, .py, .bat, .html
17
+ Along with it will diplay the unique files for each folder.
@@ -0,0 +1,7 @@
1
+ """
2
+ dircomply: A small package to compare the files between two project folders.
3
+ """
4
+ __title__ = "dircomply"
5
+ __author__ = "Benevant Mathew"
6
+ __license__ = "MIT License"
7
+ __version__ = "0.1"
@@ -0,0 +1,139 @@
1
+ import tkinter as tk
2
+ from tkinter import filedialog, messagebox
3
+ import os
4
+ import sys
5
+ from . import __version__
6
+
7
+ # extension to compare
8
+ ext_list=('.txt','.py','.bat','.html')
9
+
10
+ def print_help():
11
+ help_message = """
12
+ Usage: dircomply [OPTIONS]
13
+
14
+ A small package to compare the files between two project folders.
15
+
16
+ Options:
17
+ --version, -v Show the version of dircomply and exit
18
+ --help, -h Show this help message and exit
19
+ (No arguments) Launch the GUI application
20
+ """
21
+ print(help_message)
22
+ sys.exit(0)
23
+ # Function to read file content
24
+ def read_file(filepath):
25
+ try:
26
+ with open(filepath, 'r') as file:
27
+ return file.read()
28
+ except Exception as e:
29
+ return f"Error: {e}"
30
+
31
+ # Function to get all files with specific extensions in a folder and its subdirectories
32
+ def get_files_with_extensions(folder, extensions):
33
+ all_files = set()
34
+ for root_dir, _, files in os.walk(folder):
35
+ for file in files:
36
+ if file.endswith(extensions):
37
+ relative_path = os.path.relpath(os.path.join(root_dir, file), folder)
38
+ all_files.add(relative_path)
39
+ return all_files
40
+
41
+ # Function to compare files and find differences
42
+ def compare_folders(folder1, folder2):
43
+ folder1_files = get_files_with_extensions(folder1, ext_list)
44
+ folder2_files = get_files_with_extensions(folder2, ext_list)
45
+
46
+ # Common files
47
+ common_files = folder1_files & folder2_files
48
+
49
+ # Unique files
50
+ unique_to_folder1 = folder1_files - folder2_files
51
+ unique_to_folder2 = folder2_files - folder1_files
52
+
53
+ # Files with differences
54
+ different_files = []
55
+ for file in common_files:
56
+ path1 = os.path.join(folder1, file)
57
+ path2 = os.path.join(folder2, file)
58
+ if read_file(path1) != read_file(path2):
59
+ different_files.append(file)
60
+
61
+ return different_files, unique_to_folder1, unique_to_folder2
62
+
63
+ # GUI Application
64
+ def create_gui():
65
+ # Check for command-line arguments
66
+ if "--version" in sys.argv or "-v" in sys.argv:
67
+ print(f"version {__version__}")
68
+ sys.exit(0)
69
+ elif "--help" in sys.argv or "-h" in sys.argv:
70
+ print_help()
71
+ sys.exit(0)
72
+
73
+ def select_folder1():
74
+ path = filedialog.askdirectory(title="Select Folder 1")
75
+ if path:
76
+ folder1_var.set(path)
77
+
78
+ def select_folder2():
79
+ path = filedialog.askdirectory(title="Select Folder 2")
80
+ if path:
81
+ folder2_var.set(path)
82
+
83
+ def compare():
84
+ folder1 = folder1_var.get()
85
+ folder2 = folder2_var.get()
86
+
87
+ if not folder1 or not folder2:
88
+ messagebox.showerror("Error", "Please select both folders")
89
+ return
90
+
91
+ if not os.path.exists(folder1) or not os.path.exists(folder2):
92
+ messagebox.showerror("Error", "One or both folders do not exist")
93
+ return
94
+
95
+ # Compare folders
96
+ different_files, unique_to_folder1, unique_to_folder2 = compare_folders(folder1, folder2)
97
+
98
+ # Create result message
99
+ result = """Comparison Results:\n\n"""
100
+ if different_files:
101
+ result += "Files with differences:\n" + "\n".join(different_files) + "\n\n"
102
+ else:
103
+ result += "No files with differences found.\n\n"
104
+
105
+ if unique_to_folder1:
106
+ result += "Files unique to Folder 1:\n" + "\n".join(unique_to_folder1) + "\n\n"
107
+ if unique_to_folder2:
108
+ result += "Files unique to Folder 2:\n" + "\n".join(unique_to_folder2) + "\n\n"
109
+
110
+ # Display results in a popup window
111
+ popup = tk.Toplevel(root)
112
+ popup.title("Comparison Results")
113
+ popup.geometry("600x400")
114
+
115
+ result_text = tk.Text(popup, wrap=tk.WORD, font=("Arial", 10))
116
+ result_text.pack(expand=True, fill=tk.BOTH)
117
+ result_text.insert(tk.END, result)
118
+ result_text.config(state=tk.DISABLED)
119
+
120
+ # Main window
121
+ root = tk.Tk()
122
+ root.title("Folder File Comparator")
123
+ root.geometry("500x300")
124
+
125
+ folder1_var = tk.StringVar()
126
+ folder2_var = tk.StringVar()
127
+
128
+ # GUI Layout
129
+ tk.Label(root, text="Folder 1 Path:", font=("Arial", 12)).pack(pady=5)
130
+ tk.Entry(root, textvariable=folder1_var, width=50).pack()
131
+ tk.Button(root, text="Select Folder 1", command=select_folder1).pack(pady=5)
132
+
133
+ tk.Label(root, text="Folder 2 Path:", font=("Arial", 12)).pack(pady=5)
134
+ tk.Entry(root, textvariable=folder2_var, width=50).pack()
135
+ tk.Button(root, text="Select Folder 2", command=select_folder2).pack(pady=5)
136
+
137
+ tk.Button(root, text="Compare Folders", command=compare, font=("Arial", 12, "bold"), bg="lightblue").pack(pady=20)
138
+
139
+ root.mainloop()
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: dircomply
3
+ Version: 0.1
4
+ Summary: A small package to compare the files between two project folders.
5
+ Author: Benevant Mathew
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Natural Language :: English
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Classifier: Topic :: Utilities
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+
16
+ dircomply compares two folders for there differences in these extensions files - .txt, .py, .bat, .html
17
+ Along with it will diplay the unique files for each folder.
@@ -0,0 +1,8 @@
1
+ setup.py
2
+ dircomply/__init__.py
3
+ dircomply/main.py
4
+ dircomply.egg-info/PKG-INFO
5
+ dircomply.egg-info/SOURCES.txt
6
+ dircomply.egg-info/dependency_links.txt
7
+ dircomply.egg-info/entry_points.txt
8
+ dircomply.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dircomply = dircomply.main:create_gui
@@ -0,0 +1 @@
1
+ dircomply
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
dircomply-0.1/setup.py ADDED
@@ -0,0 +1,27 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="dircomply", # Name of your package
5
+ version="0.1", # Version of your package
6
+ description="A small package to compare the files between two project folders.", # Short description
7
+ long_description=open("readme.md").read(), # Detailed description
8
+ long_description_content_type="text/markdown",
9
+ author="Benevant Mathew",
10
+ license="MIT", # License type
11
+ packages=find_packages(include=["dircomply"]), # Include only 'dircomply' directory
12
+ install_requires=[], # Add dependencies here
13
+ entry_points={
14
+ "console_scripts": [
15
+ "dircomply = dircomply.main:create_gui", # entry point
16
+ ],
17
+ },
18
+ classifiers=[
19
+ "Programming Language :: Python :: 3",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Natural Language :: English",
22
+ "Operating System :: OS Independent",
23
+ "Topic :: Software Development :: Libraries :: Python Modules",
24
+ "Topic :: Utilities",
25
+ ],
26
+ python_requires=">=3.7", # Specify minimum Python version
27
+ )