Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
- Fix a bug that caused the search to crash in certain situations
- Update the build pipeline to automatically update the release version
- Temporarily disable twine uploads for testing
  • Loading branch information
dennis-carlson-sudo committed May 13, 2024
1 parent 357f6d4 commit c6698a7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- name: Change directory and set up Rust Toolchain
run: |
cd mystiks_core
echo "Working directory: $PWD"
rustup toolchain install stable
rustup default stable
rustup update
Expand All @@ -41,6 +40,15 @@ jobs:
- name: Lint with flake8
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

- name: Update Mystiks Core version
working-directory: ./mystiks_core
run: |
RELEASE_NAME="${{ github.event.release.name }}"
VERSION="${RELEASE_NAME:1}"
sed -i '0,/version = "1.0.0"/s//version = "${VERSION}"/' Cargo.toml
cat Cargo.toml
if: github.event_name == 'release' && github.event.action == 'created'

- name: Compile Mystiks Core
working-directory: ./mystiks_core
run: |
Expand All @@ -49,15 +57,23 @@ jobs:
maturin build --release --strip
cp ./target/release/libmystiks_core.so ../mystiks/mystiks_core.cpython-${python_release}-x86_64-linux-gnu.so
- name: Update Mystiks version
run: |
RELEASE_NAME="${{ github.event.release.name }}"
VERSION="${RELEASE_NAME:1}"
sed -i "0,/version='1.0.0'/s//version='${VERSION}'/" setup.py
cat setup.py
if: github.event_name == 'release' && github.event.action == 'created'

- name: Build the package
run: python -m build

- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
# - name: Upload to PyPI
# env:
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
# run: twine upload dist/*
# if: github.event_name == 'release' && github.event.action == 'created'

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
6 changes: 3 additions & 3 deletions mystiks/findings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def get_indicators(this, context, capture, capture_start, capture_end, groups):
else:
indicators.append(('Capture is segmented', 0.5))
# We check whether the capture is defined as a value. TODO: Make this a regex.
elif (start_character == ord('=') and end_character in b';\n\\ ,'):
elif (start_character == ord('=') and (not end_character or end_character in b';\n\\ ,')):
indicators.append(('Capture appears defined', 0.25))
# We check whether the capture is at the start of a potentially-segmented file.
elif (start_character == None and end_character in SEGMENTATION_LETTERS) \
or (end_character == None and start_character in SEGMENTATION_LETTERS):
elif (start_character == None and end_character and end_character in SEGMENTATION_LETTERS) \
or (end_character == None and start_character and start_character in SEGMENTATION_LETTERS):
indicators.append(('Capture appears segmented', 0.25))
else:
indicators.append(('Capture is not segmented', -0.5))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='mystiks',
version='1.0.1',
version='1.0.0',
packages=find_packages(),
entry_points={
'console_scripts': [
Expand Down

0 comments on commit c6698a7

Please sign in to comment.