#50958 Issue 50954 - buildnum.py - fix date formatting issue
Closed 3 years ago by spichugi. Opened 4 years ago by mreynolds.
mreynolds/389-ds-base issue50954  into  master

file modified
+4 -9
@@ -14,15 +14,10 @@ 

  

  SDE = os.getenv('SOURCE_DATE_EPOCH')

  if SDE is not None:

-     obj = time.gmtime(int(SDE))

+     gmtime_obj = time.gmtime(int(SDE))

  else:

-     obj = time.gmtime()

+     gmtime_obj = time.gmtime()

      

- year = obj[0]

- doy = obj[7]

- if doy < 100:

-     doy = "0" + str(doy)

- tod = str(obj[3]) + str(obj[4])

- buildnum = f"{year}.{doy}.{tod}"

- 

+ # Print build number

+ buildnum = time.strftime("%Y.%j.%H%M", gmtime_obj)

  print(f'\\"{buildnum}\\"', end = '')

Description: We need to zero pad the hour and minute is they are less than "10"

relates: https://pagure.io/389-ds-base/issue/50954

Hmm, wouldn't it be better to just use time.strftime on whatever the time.gmtime returned? Or is there something missing?

rebased onto e6c368d40c38a3c12d063c1f2b296c0f23f515ad

4 years ago

Hmm, wouldn't it be better to just use time.strftime on whatever the time.gmtime returned? Or is there something missing?

Ah yes, very nice - thanks for the suggestions. Please review...

rebased onto 8451c42e5a713333954101057b80bdd253188290

4 years ago

rebased onto b32c745

4 years ago

Pull-Request has been merged by mreynolds

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4011

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata