Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
63 lines
1.8 KiB
Python
Executable File
63 lines
1.8 KiB
Python
Executable File
import os
|
|
import re
|
|
|
|
_escape_pat = re.compile(r'%([0-9A-Fa-f]{2})')
|
|
def unescape(v):
|
|
def repl(match):
|
|
n = int(match.group(1), base=16)
|
|
return chr(n)
|
|
return _escape_pat.sub(repl, v)
|
|
|
|
def parse_addresses(s):
|
|
for addr in s.split(';'):
|
|
transport, info = addr.split(':', 1)
|
|
kv = {}
|
|
for x in info.split(','):
|
|
k, v = x.split('=', 1)
|
|
kv[k] = unescape(v)
|
|
yield (transport, kv)
|
|
|
|
SUPPORTED_TRANSPORTS = ('unix',)
|
|
|
|
def get_connectable_addresses(addr):
|
|
unsupported_transports = set()
|
|
found = False
|
|
for transport, kv in parse_addresses(addr):
|
|
if transport not in SUPPORTED_TRANSPORTS:
|
|
unsupported_transports.add(transport)
|
|
|
|
elif transport == 'unix':
|
|
if 'abstract' in kv:
|
|
yield '\0' + kv['abstract']
|
|
found = True
|
|
elif 'path' in kv:
|
|
yield kv['path']
|
|
found = True
|
|
|
|
if not found:
|
|
raise RuntimeError("DBus transports ({}) not supported. Supported: {}"
|
|
.format(unsupported_transports, SUPPORTED_TRANSPORTS))
|
|
|
|
def find_session_bus():
|
|
addr = os.environ['DBUS_SESSION_BUS_ADDRESS']
|
|
return next(get_connectable_addresses(addr))
|
|
# TODO: fallbacks to X, filesystem
|
|
|
|
def find_system_bus():
|
|
addr = os.environ.get('DBUS_SYSTEM_BUS_ADDRESS', '') \
|
|
or 'unix:path=/var/run/dbus/system_bus_socket'
|
|
return next(get_connectable_addresses(addr))
|
|
|
|
def get_bus(addr):
|
|
if addr == 'SESSION':
|
|
return find_session_bus()
|
|
elif addr == 'SYSTEM':
|
|
return find_system_bus()
|
|
else:
|
|
return next(get_connectable_addresses(addr))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
print('System bus at:', find_system_bus())
|
|
print('Session bus at:', find_session_bus())
|