Skip to content

Commit

Permalink
Bug fix: Generated Spec file not being uploaded for .py files (#30)
Browse files Browse the repository at this point in the history
* refactoring

* ref

* spec name
  • Loading branch information
sayyid5416 authored Nov 29, 2024
1 parent 3d3c1bc commit 559f380
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@


# Minor parsing
specName, specExt = os.path.splitext(
spec
) # spec-name-with-path & spec-extension
specPath, specExt = os.path.splitext(spec) # spec-name-with-path & spec-extension
providedOptions = [
i.strip() for i in options.split(',') if i.strip() != ''
] # list of provided options
Expand Down Expand Up @@ -65,21 +63,15 @@
option_key = option.split()[0]
if bool(option_key in pyOptions_keys and specExt == '.py') or \
bool(option_key in specOptions_keys and specExt == '.spec'):
supported_options.append(
option
)
supported_options.append(option)
else:
unsupported_options.append(
option
)
unsupported_options.append(option)

## Supported options -> OUTPUT -> NOTICE
if supported_options:
set_output(
'supported_options',
' '.join(
supported_options
)
' '.join(supported_options)
)
set_annotation(
f"Options setted for '{specExt}' spec type: {', '.join(supported_options)}",
Expand All @@ -106,20 +98,17 @@ def get_option_value(option: str):
return value.strip('"').strip("'")


## ---------------------- Spec Name ---------------------- ##
_specName = str(specName)
_specPath = str(specPath)

# If "--name" option is specified in options
specfiedName = get_option_value('-n') or get_option_value('--name')
if specfiedName:
_specName = os.path.join(
os.path.split(
_specName
)[0], #path w/o filename
_specPath = os.path.join(
os.path.split(_specPath)[0], #path w/o filename
specfiedName #new filename
) #new path of spec file

set_output(
'spec_name',
_specName
os.path.basename(_specPath)
)

0 comments on commit 559f380

Please sign in to comment.